Based on HTML 5 server push technology, WebSocket are a communications protocol compatible with HTTP. The WebSocket protocol facilitates real-time, bi-directional, and highly scalable data transfer between client and server applications using a publish/subscribe model. Implementing WebSocket is a useful strategy for building applications that need instant data updates without a browser refresh (stock market tickers, social media, games, etc).
There are two methods of leveraging WebSocket in ColdFusion: Using the built-in ColdFusion WebSocket server, or proxying to an external web server. The built-in server can be configured via the ColdFusion Administrator as shown.
Of particular note among these settings is Max Data Size. This value should be determined through testing to evaluate the appropriate size of your payloads.
To proxy WebSocket requests to an external server, additional configuration is required. The settings in this guide will focus on a Windows installation.
Tip: Only IIS8 and later versions support WebSocket natively.
Begin by installing WebSocket support in your IIS server. A walk-through of that process can be found here.
Next, we need to ensure that IIS is connected to ColdFusion via the web server connector. Open the ColdFusion Web Server Configuration Tool (C:\ColdFusion2018\cfusion\runtime\bin
and run wsconfig.exe
as Administrator). We see this dialog confirming that IIS and ColdFusion are connected.
The next step is to configure IIS as the WebSocket proxy server. Go to C:\ColdFusion2018\cfusion\bin
and run wsproxyconfig.exe
as Administrator.