On this page:
ws-send
ws-send-ready-evt
ws-send-evt
ws-receive
ws-receive-ready-evt
ws-receive-evt

2.3 Exchanging WebSocket Messages

(ws-send socket frame)  any
  socket : ws-socket?
  frame : (or/c bytes? string?)
Sends a message through the WebSocket socket. The message can be either a byte string, which will be sent with frame type 128 and length information, or a string, which will be sent with frame type 0 and without length information.

(ws-send-ready-evt socket)  evt?
  socket : ws-socket?
Returns a synchronizable event that becomes ready when data can be written to the WebSocket socket and returns the socket itself when chosen.

(ws-send-evt socket frame)  evt?
  socket : ws-socket?
  frame : (or/c bytes? string?)
Returns a synchronizable event that becomes ready when data can be written to the WebSocket socket, sends the given frame when chosen and returns a void value.

(ws-receive socket)  (or/c bytes? string? eof-object?)
  socket : ws-socket?
Receives a message through the WebSocket socket. The message returned will be a byte string for frames of type 128 and a string for frames of type 0. Any other frame type causes an error.

If the WebSocket connection is closed before ws-receive can read any data, the end of file object is returned instead.

(ws-receive-ready-evt socket)  evt?
  socket : ws-socket?
Returns a synchronizable event that becomes ready when data can be read from the WebSocket socket and returns the socket itself when chosen.

(ws-receive-evt socket)  evt?
  socket : ws-socket?
Returns a synchronizable event that becomes ready when data can be read from the WebSocket socket and returns the incoming frame or an end of file object when chosen.