Can I use Cloudflare with WebSockets?


WebSockets are available for all Cloudflare customers, with concurrent connections allocated by plan. Learn more about WebSockets and the most common uses of the protocol.

WebSockets are open connections sustained between the client and the origin server. Inside a WebSockets connection, the client and the origin can pass data back and forth without having to reestablish sessions. This makes exchanging data within a WebSockets connection fast. WebSockets are often used for real-time applications such as live chat and gaming.

While Cloudflare Workers supports proxying WebSockets, it currently does not support:
  • Acting as an endpoint (client or server) for a WebSocket session
  • Manipulating individual messages

What plan do I need to be on for my site?

Cloudflare plan Volume of
concurrent connections
Example use case
Free Low Hobby or demonstration site
Pro Medium Project or small business
Business High Important to your operations
Enterprise Custom Mission critical and significant volume

Why are these volume limits not specific numbers?

Cloudflare powers several high-volume, mission critical WebSockets applications for Enterprise customers.

Since introducing WebSockets support in 2014, Cloudflare has nearly tripled its network map, going from 28 locations to over 150 (as mid-2018). In all locations, we've added compute resources and multiple Tier 1 bandwidth providers.

We're confident in our ability to offer WebSockets to all our customers now, but we're also thoughtful about allocating resources – including WebSockets connections – by plan level. So, we're starting with guidelines, and we'll learn from our customers' adoption.

We enable modern technologies which make the Internet better. The best way to do that is let customers play, grow, and thrive.

If my site uses more concurrent WebSockets connections than Cloudflare expects, what will happen?

Immediately, nothing. Within reason, Cloudflare will allow occasional spikes in usage beyond our guidelines, and we will not apply unnecessary limits.

Repeated spikes or high continued usage will prompt a dialogue: we'll reach out to learn more about your application. Barring abuse or attack, we will not impose limits errors for any application without contacting the customer.

Customers whose usage claims a disproportionate percentage of resources for their current plan level may be asked to upgrade to the plan level that matches their needs.

How can I use WebSockets with Cloudflare?

No additional configuration is required to send WebSockets traffic through Cloudflare. Cloudflare will immediately begin proxying your WebSockets through to your origin. 

Can I use WebSockets over SSL?

Yes. WebSockets through Cloudflare are fully compatible with Cloudflare's SSL and wss scheme is supported.

Technical note

When Cloudflare releases new code to its global network, we may restart servers, which terminates WebSockets connections. 

Not finding what you need?

95% of questions can be answered using the search tool. This is the quickest way to get a response.

Powered by Zendesk