server side websocket refator