Websocket and map-based hash-type

We have a service which has hashing built into it. This adds a lot of complexity to the service code and we would like to simplify the design. One thought that we had is to move the has map to haproxy and then the service can simply handle requests that come to it. The complication is that the client communicates with this service via websockets.

What I want to do is use a map-based hash-type to distribute the load across the servers that are “UP”. This is fairly easy to do. The question that I have is that when a server status changes we want to re-distribute the existing websockets. Is there a way to terminate existing websockets when a hash-map changes so that clients re-establish the websocket to the new correct hash map?

EDIT:
I should add that one thing that we are considering is having an external shell script using the stats socket to check to see if the server config changes (add/remove server to backend OR server status changes UP/DOWN). If it detects a change then we could terminate all connections to all of the servers to force all clients to reconnect by issuing a:
shutdown sessions server /

What we are hoping is that we can have haproxy do this internally rather than us doing it. :slight_smile: