added websocket fixes and disconnect detection