Working encapsulated websocket