Close the connection and release all resources.
Register a handler for incoming data. Must be called before write() — data can arrive as soon as the connection is established.
Send data over the connection. Accepts a Uint8Array or a string.
Close the connection and release all resources.