Can I use Cloudflare with WebSockets?

Yes, 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.

 

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 nearly 80 (early May 2016, with lots more coming). 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. When terminating a WebSocket connection due to releases, Cloudflare signals this action to both client and origin server by sending the 1001 status code (aka "going away", see section 7.4.1 of RFC 6455), so both sides are aware that the WebSocket termination is only a transient event, and that they can expect to immediately re-establish a connection again on retry.

 

Still not finding what you need?

The Cloudflare team is here to help. 95% of questions can be answered using the search tool, but if you can’t find what you need, submit a support request.

Powered by Zendesk