Search⌘ K
AI Features

Upgrading WebSocket Connections

Explore how to upgrade HTTP requests to WebSocket connections in Phoenix applications. Understand the protocol switch process, the role of HTTP 101 responses, and how to verify the upgrade using cURL commands and browser DevTools. This lesson helps you manage and maintain real-time WebSocket connections essential for fast, efficient applications.

How to generate cURL

The easiest way to generate the cURL request is as follows:

  1. First, right-click the request labelled websocket?token=undefined&vsn=2.0.0 under the “Name” column and then expand Copy.

  2. Then select the “Copy as cURL” option. This will copy a cURL request to a ws protocol URL.

  3. Paste the cURL request into your favorite editor and replace ws:// with http://. ...