More websockets refactoring