how to use Websocket compatible API for example socket.send()