I have an application that provides live data from the market in a game. The app has a websockets API so users can watch data and make their own predictions. I have a small server with limited bandwidth. When many users trying to use the API, many lose their connection or are unable to connect at all. How can I use a load balancer so that the server has only one connection to cloudflare and the load balancer delivers data to all users? The application does not accept message from users. It only streams JSON data
I am assuming you mean a Cloudflare Load balancer?
I do not believe a load balancer is going to help you in your request here, under the hood the behavior of a load balancer does not behave this way - “How can I use a load balancer so that the server has only one connection to Cloudflare and the load balancer delivers data to all users”
The way tunnels works is establishing a connection to a couple of our nearest datacenters from your origin and then traffic routes through those datacenters and down the tunnel to reach your origin, which in theory should reduce the amount of connections to your origin server.
There would be no benefit for you in looking at load balancing, especially with one server as you lose one of the main benefits of load balancing which is to be able to failover between servers when one is unavailable.