Added back logic to recreate websocket when closed