We are using Plack::Builder to create a WebSocket server using Twiggy.
Currently we are mounting the Web Socket endpoints thus:-
builder {
mount "/ws/chat" => MyWebSocket::Chat->new({ server => 'Darwin' })->to_app;
mount "/ws/app" => MyWebSocket::App->new({ server => 'Einstein'})->to_app;
mount "/ws/app2" => MyWebSocket::App->new({ server => 'Newton'})->to_app;
}
We are also doing the development on one server.
The design of the code is such that functionality is split with different functions (e.g. 'Chat' and 'App') which can easily be moved onto different servers as the usage increases.
We would also like to be able to replicate the same function across multiple back-end servers (e.g. several 'app' servers)
I want to be able to dynamically add and remove servers without affecting the users experience (e.g. add more 'chat' servers if the load increases) also the ability to take down one or more servers for maintenance would be useful.
I think I might be missing some key concepts here. I can't see an easy way to do this. Since it is a Web Socket server, once a connection is made to one of the back-end servers, it should persist until the connection is closed.
Are there any examples which do something similar that I could be referred to?
Kind Regards
Iain C Docherty.