clean up websocket & add tests