Registry / messaging / socket-signal-websocket

socket-signal-websocket

JSON →
library10.0.7jsnpmunverified

SocketSignal WebSocket is a signaling server and client for WebRTC peer connections using simple-websocket and reconnecting-websocket. Current stable version is 10.0.7. It provides a WebSocket-based transport for the socket-signal protocol, enabling WebRTC signaling with automatic reconnection and multiple server fallback. Key differentiators include built-in heartbeat support, reconnection logic via reconnecting-websocket, and integration with simple-peer for data channels. It is actively maintained by GEUT.

npm install socket-signal-websocket
INSTALL
IMPORT
SIG · SOCKET-SIGNAL-WEBS
S
socket-signal-websocket
messagingjavascriptv10.0.7
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SocketSignalWebsocketClient
import { SocketSignalWebsocketClient } from 'socket-signal-websocket'
const SocketSignalWebsocketClient = require('socket-signal-websocket')
ESM and CJS both available; named export in both cases.
SocketSignalWebsocketServer
import { SocketSignalWebsocketServer } from 'socket-signal-websocket'
const server = require('socket-signal-websocket').SocketSignalWebsocketServer
Server class exported as named export.
default
import SocketSignalWebsocket from 'socket-signal-websocket'
const SocketSignalWebsocket = require('socket-signal-websocket').default
No default export; ESM users must use named imports.

Creates a SocketSignalWebsocketClient, opens connection, joins a topic, and connects to a discovered peer via WebRTC.

import { SocketSignalWebsocketClient } from 'socket-signal-websocket' const client = new SocketSignalWebsocketClient(['ws://localhost:4000'], { heartbeat: { interval: 10000, timeout: 5000 }, simpleWebsocket: {}, reconnectingWebsocket: {}, simplePeer: {} }); (async () => { await client.open() client.onIncomingPeer(async (peer) => { if (validPeer(peer)) return throw new Error('invalid peer') }) const peersForThatTopic = await client.join('room1') if (peersForThatTopic.length > 0) { const remotePeer = client.connect('room1', peersForThatTopic[0]) try { await remotePeer.ready() console.log('SimplePeer connected') } catch(err) { console.error('SimplePeer rejected', err) } } })()
Debug
Known issues
gotchaThe constructor accepts an array of URLs for fallback, but if all fail, the client does not automatically retry indefinitely; it will reject with an error.
fix
Implement custom retry logic around client.open() if multiple fallbacks may all fail.
affects: >=1.0.0
gotchaThe heartbeat option is optional but if not provided, no heartbeat is sent; the connection may not detect stale sockets.
fix
Always configure heartbeat interval and timeout to ensure connectivity checks.
affects: >=1.0.0
gotchaThe simplePeer option passed in the constructor is used for all new Peer instances; you cannot override per-connection options easily.
fix
Set global simplePeer options in constructor; if per-connection tuning is needed, consider wrapping the client.
affects: >=1.0.0
breakingv10.0.0 changed the default export to named exports; existing code using default import (import x from 'socket-signal-websocket') will break.
fix
Switch to named imports: import { SocketSignalWebsocketClient } from 'socket-signal-websocket'
affects: >=10.0.0
deprecatedThe method 'client.close()' is deprecated; use 'client.destroy()' to properly clean up resources.
fix
Replace client.close() with client.destroy()
affects: >=9.0.0
Errors
Common errors & fixes
Error: Cannot find module 'socket-signal-websocket'
Package not installed or import path wrong.
fix
Run: npm install socket-signal-websocket
TypeError: client.open is not a function
Importing default instead of named export in v10+.
fix
Use: import { SocketSignalWebsocketClient } from 'socket-signal-websocket'
Error: require() of ES Module not supported
Using require() with an ES module package.
fix
Use dynamic import: const { SocketSignalWebsocketClient } = await import('socket-signal-websocket')
TypeError: remotePeer.ready is not a function
remotePeer might be null or the peer object structure changed.
fix
Check that peersForThatTopic returns valid peers and that connect returns a valid peer object with ready() method.
Upgrade
Version history
10.0.7latest on npm
Audit
Dependencies
simple-websocketrequiredUnderlying WebSocket implementation for signaling server and client
reconnecting-websocketrequiredProvides reconnection support for WebSocket connections
simple-peerrequiredUsed for WebRTC peer connections after signaling
Agent activity
16 hits · last 30 days
node
14
OpenAI (training)
1
Resources
socket-signal-websocket — npm install socket-signal-websocket · libregistry