HomeDev GuideRecipesAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

WebSocket support

Describes using a WebSocket connection to improve the user interface experience.

A WebSocket connection notifies the user interface about available updates so that users see changes without an explicit page refresh. WebSockets are used in the Projects and Notifications areas.

🚧

Important

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

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

Enable WebSocket support

WebSocket connections provide real-time communication between the browser and server, eliminating the need for manual page refreshes.

If WebSockets are not already installed, install them on a Windows machine by following these instructions.

WebSockets are turned on by default in Optimizely.

Troubleshoot and disable 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 connecting to the web server directly to ensure it is properly configured. When the web server is confirmed as not the problem, look into the proxy server configuration and verify that it supports WebSockets.

As a last resort, turn off WebSocket support on the web server by changing the WebSocketEnabled property from the EPiServer.Web.UIOptions class. This prevents Optimizely Content Management System (CMS) edit user interface from establishing a WebSocket connection to the server, and the end-user has a degraded experience.

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

Important

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