Real-time / Web
SIP over WebSocket (WSS)
SIP over Secure WebSocket (WSS) is a transport binding (RFC 7118) that lets browsers and JavaScript softphones speak SIP signaling natively. Combined with WebRTC media, it is how zero-install browser phones work.
Why WebSocket?
SIP traditionally runs on UDP/TCP/TLS. Browsers cannot open raw UDP or TCP sockets, so SIP-over-WebSocket was standardized to fit the browser's networking model. WSS = WebSocket Secure (over TLS).
The wire format is plain SIP messages framed by WebSocket's text-frame boundary — the same INVITE / 200 OK / BYE you would send over UDP, just wrapped in a WebSocket frame.
Connection example
// Using sip.js const ua = new SIP.UserAgent({ uri: SIP.UserAgent.makeURI("sip:[email protected]"), transportOptions: { server: "wss://wss.didhub.io", }, authorizationUsername: "trunk_xxxxx", authorizationPassword: "<PASSWORD>", }); await ua.start();
Common gotchas
- Mixed-content: a page served over HTTPS cannot connect to
ws://— onlywss://. - Origin allow-list: the WSS server should accept the browser's
Originheader. DIDHub WSS accepts any origin for trunked customers. - Keepalives: NATs and proxies kill idle WebSockets. Set CRLF keepalives every 30s.
Related terms
Ready to get a number?
Pick a DID in 130+ countries from $1.99/month. Activates instantly on most numbers.