Loading...
Area: Optimizely CMS
Applies to versions: 12 and higher
Other versions:

WebSocket support in the CMS user interface

Recommended reading 

In Optimizely CMS, a WebSocket connection is used to improve the user interface experience. It notifies the user interface about available updates so that users see changes without an explicit page refresh. Currently WebSockets are used in the Project overview and in the Notifications area.

Known limitation: If the app runs on Windows with IIS then the WebSocket support must be installed and enabled on the web server. Without WebSocket support, you must manually refresh the user interface for notifications, or updated comments and project items to show.

How it works

A WebSocket connection is a full-duplex communication channel over TCP from the browser client to the web server, and was standardized by IETF as RFC6445 in 2011. It is available in all modern browsers, but may still pose a problem with firewalls and reverse proxies not yet implementing the standard.

How to enable WebSocket support

If you have not installed WebSockets already, you need to install WebSockets on a Windows machine by following these instructions.

Websockets are turned on by default in Optimizely.

Troubleshooting and disabling WebSocket support

A WebSocket connection is initiated as a plain HTTP GET request with a `Connection:Upgrade` header, whereby the server responds with a similar upgrade reply. If a non-supporting proxy server or firewall receives this request, it most likely drops the headers and returns the `200 OK` response from the server, causing the client to close the connection. If this is the case; try bypassing the middle-tier and connect to the web server directly to make sure it is properly configured. When you are sure that the web server is not the problem, start looking into the proxy server configuration and see whether it supports web sockets.

As a last resort, you can disable the WebSocket support on the web server changing the WebSocketEnabled property form the EPiServer.Web.UIOptions class. By doing this, the CMS edit user interface does not establish a WebSocket connection to the server, and the end user has a degraded experience.

services.Configure<UIOptions>(options =>
{
    options.WebSocketEnabled = false;
});

Known limitation

WebSockets are currently used in the project overview and notification areas. Developers cannot use the module (Realtime.js) that enables this since it is internal.

Do you find this information helpful? Please log in to provide feedback.

Last updated: Sep 28, 2021

Recommended reading