implemented ws reconnect and server gracefully shutdown websocket