Registry / communication / jssip-node-websocket

jssip-node-websocket

JSON →
library3.0.0jsnpmunverified

Provides JsSIP.Socket interface for Node.js using the WebSocket-Node (websocket) module. Version 3.0.0 requires jssip >=3.0.0. It enables SIP over WebSocket in Node.js environments where the browser-native WebSocket is unavailable. Compared to alternatives like reconnection or raw WebSocket usage, this package conforms to JsSIP's Socket interface, simplifying integration with JsSIP UA. The package wraps the W3CWebSocket class from WebSocket-Node, supporting custom origin, headers, request options, and TLS configuration. It is maintained by the JsSIP core team and follows a stable release cadence with minimal breaking changes between major versions.

npm install jssip-node-websocket
INSTALL
IMPORT
SIG · JSSIP-NODE-WEBSOCK
J
jssip-node-websocket
communicationjavascriptv3.0.0
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.

NodeWebSocket
import NodeWebSocket from 'jssip-node-websocket';
const { NodeWebSocket } = require('jssip-node-websocket');
Package exports a single class as default export. Use default import in ESM or require with destructuring only if using CJS interop.
jssip-node-websocket (CJS require)
const NodeWebSocket = require('jssip-node-websocket');
const nodeWebSocket = require('jssip-node-websocket');
CommonJS users should assign the result directly to a variable; the export is a constructor function.
NodeWebSocket with JsSIP in ESM
import JsSIP from 'jssip'; import NodeWebSocket from 'jssip-node-websocket';
import { JsSIP } from 'jssip';
JsSIP uses a default export, not named. NodeWebSocket is also a default export.

Shows how to create a NodeWebSocket instance with TLS options and use it to initialize a JsSIP user agent.

const JsSIP = require('jssip'); const NodeWebSocket = require('jssip-node-websocket'); const socket = new NodeWebSocket('wss://example.com:8443/ws', { origin: 'https://example.com', requestOptions: { agent: new require('https').Agent({ rejectUnauthorized: false }) } }); const ua = new JsSIP.UA({ uri: 'sip:alice@example.com', password: process.env.SIP_PASSWORD ?? '', display_name: 'Alice', sockets: [socket] }); ua.start();
Debug
Known issues
breakingVersion 3.0.0 requires jssip >=3.0.0. Previous versions (<=2.x) required jssip ^2.0.0. Upgrade both packages simultaneously.
fix
Update jssip to ^3.0.0 and jssip-node-websocket to ^3.0.0 in package.json.
affects: >=3.0.0
gotchaThe underlying websocket package version must be compatible with Node.js runtime. Older Node.js versions may require specific websocket versions.
fix
Ensure Node.js >=4.0.0 as per engine requirement. For Node.js >=12, websocket 1.0.34+ works.
affects: >=0.0.0
deprecatedThe requestOptions.agent pattern for allowing invalid TLS certificates is discouraged in production. Use a proper CA instead.
fix
Avoid rejectUnauthorized: false in production; set proper ca option or use environment variable NODE_TLS_REJECT_UNAUTHORIZED=0 only for testing.
affects: >=0.0.0
gotchaIf the WebSocket connection fails, the error may not propagate to JsSIPUA unless socket is properly handled.
fix
Listen to socket events (e.g., 'connect', 'disconnect') to handle errors and retry logic.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'jssip-node-websocket'
Package not installed or missing dependency.
fix
Run `npm install jssip-node-websocket` and ensure it's listed in package.json.
TypeError: NodeWebSocket is not a constructor
Incorrect import: using named import instead of default import in ESM.
fix
Use `import NodeWebSocket from 'jssip-node-websocket'` (default import) instead of `import { NodeWebSocket } from 'jssip-node-websocket'`.
Error: The module 'jssip' must be installed and version >=3.0.0
jssip version too old or not installed.
fix
Run `npm install jssip@^3.0.0`.
Upgrade
Version history
3.0.0latest on npm
Audit
Dependencies
jssiprequiredPeer dependency required at runtime to provide JsSIP UA and Socket interface
websocketrequiredUnderlying WebSocket implementation used for Node.js communication
Agent activity
14 hits · last 30 days
node
12
OpenAI (training)
1
Resources
jssip-node-websocket — npm install jssip-node-websocket · libregistry