I wanted to setup load balancing for my website and so when you request to the websocket address it will then route your connection to a WebSocket server with the most resources available at the current request time. My website is a chat website and updating the chat for other users with WebSockets isn't very hard if it's all running on one server.
Let's say User one sends a message to TestUser.
User has a connection ID of 120 and TestUser has the ID of 174, Now the server will look through the connections that match the user and get the ID then get the connection and then send the response to TestUser.
But if both users are on two different servers and I store their connections on a database in a serialized form and then get them to a variable, Can I still use that connection?
Do the connections contain some kind of authentication to send a message as a server? If not what could I try. I do not want to replace my load balancer with a single server.
Thanks!
NOTE: I listed Java and PHP as I use both languages for WebSockets for their own reasons, as I develop for other people based on what language they prefer, Which in my case mainly it's Java and PHP
source https://stackoverflow.com/questions/67731322/is-it-possible-to-serialize-a-websocket-connection-object-and-reuse-it-on-anothe
Comments
Post a Comment