What is the WebSocket protocol (ws:// and wss://)?

Answer

WebSocket URLs use the schemes ws:// and wss:// analogously to HTTP's http:// and https://. ws:// is the unencrypted WebSocket protocol — the connection data is sent in plaintext, susceptible to eavesdropping. wss:// is WebSocket Secure — the WebSocket connection is wrapped in TLS (the same as HTTPS), providing encryption, authentication, and integrity protection. In production, always use wss://. Modern browsers block mixed content — if your page is served over HTTPS, any WebSocket connections must use wss:// or the browser will refuse the connection. wss:// typically runs on port 443, the same as HTTPS, which avoids firewall issues that port 80 (ws://) may not have.