The client is a refactoring of the Websocket test found at: http://websocket.org/echo.html The server is a simple Node.js Socket.io server which responds to the client's 'test' event, by responding with the client connection id. When the client receives the server's 'test' event, it closes the connection.
See http://cliffordhall.com/2016/10/persistent-connections-with-socket-io/