How WebSocket works in a ServiceNow instanceIssue <!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: #000000; } span { font-size: 12pt; font-family: Lato; color: #000000; } h2 { font-size: 24pt; font-family: Lato; color: black; } h3 { font-size: 18pt; font-family: Lato; color: black; } h4 { font-size: 14pt; font-family: Lato; color: black; } a { font-size: 12pt; font-family: Lato; color: #00718F; } a:hover { font-size: 12pt; color: #024F69; } a:target { font-size: 12pt; color: #032D42; } a:visited { font-size: 12pt; color: #00718f; } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } Learn how the WebSocket protocol works in a ServiceNow instance, including how ServiceNow uses WebSocket for Asynchronous Message Bus (AMB) communication, how to troubleshoot WebSocket connection errors, and how to disable the WebSocket protocol. Release<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: #000000; } span { font-size: 12pt; font-family: Lato; color: #000000; } h2 { font-size: 24pt; font-family: Lato; color: black; } h3 { font-size: 18pt; font-family: Lato; color: black; } h4 { font-size: 14pt; font-family: Lato; color: black; } a { font-size: 12pt; font-family: Lato; color: #00718F; } a:hover { font-size: 12pt; color: #024F69; } a:target { font-size: 12pt; color: #032D42; } a:visited { font-size: 12pt; color: #00718f; } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } Beginning with the Madrid release Resolution<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: #000000; } span { font-size: 12pt; font-family: Lato; color: #000000; } h2 { font-size: 24pt; font-family: Lato; color: black; } h3 { font-size: 18pt; font-family: Lato; color: black; } h4 { font-size: 14pt; font-family: Lato; color: black; } a { font-size: 12pt; font-family: Lato; color: #00718F; } a:hover { font-size: 12pt; color: #024F69; } a:target { font-size: 12pt; color: #032D42; } a:visited { font-size: 12pt; color: #00718f; } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } What is WebSocket WebSocket is a protocol that provides full-duplex communication channels over a single TCP connection. Unlike HTTP, which provides half-duplex communication, WebSocket supports bidirectional information exchange. This means a server can push information to a client, which standard HTTP does not support. How ServiceNow uses WebSocket In a ServiceNow instance, the WebSocket protocol is used by the Asynchronous Message Bus (AMB). WebSocket improves AMB performance because it is more efficient than long-polling. If a WebSocket connection cannot be established due to a firewall, proxy, or other network restriction, the system falls back to long-polling and continues to function normally. With WebSocket and long-polling, AMB supports the following features: ChatVirtual task boardAgent WorkspacePresence indicators Clients can send messages on channels they have subscribed to. The server receives the message and publishes it to other clients subscribed to that channel. WebSocket connection errors When a client attempts to communicate over WebSocket, it first assumes the server supports the protocol. If the client does not receive an acknowledgment from the server, the following error appears in the browser console log: js_includes_concourse.jsx?v=05-01-2020_1402&lp=Sun_Jun_07_18_36_34_PDT_2020&c=38_1037:3084 WebSocket connection to 'wss://<instance_name>.service-now.com/amb' failed: Error during WebSocket handshake: Unexpected response code: 400(anonymous) @ js_includes_concourse.jsx?v=05-01-2020_1402&lp=Sun_Jun_07_18_36_34_PDT_2020&c=38_1037:3084 If the communication channel is blocked by a firewall, load balancer, VPN, or proxy rule, this error is expected. The client automatically falls back to long-polling (HTTP) when WebSocket is not available. Disable the WebSocket protocol The WebSocket protocol is enabled by default on ServiceNow instances. To disable it, set the glide.cometd.websocket.enabled system property to false. Create the property if it does not exist. Note: Disabling WebSocket forces the system to use long-polling for all AMB communication, which is less efficient. Only disable WebSocket if required by your network configuration. Test WebSocket connectivity To test WebSocket connectivity from the client side, go to the following diagnostic page: https://<instance_name>.service-now.com/$websocket_testReplace <instance_name> with your instance name.