An environment is returned. The service will search the environment
for callback functions named:
closed
, established
, and receive
.
The established
and closed
functions must take a single
argument (a websocket).
The receive
function must take three arguments: DATA, WS, and HEADER,
holding the message data, websocket client, and possible
ancillary header information received.
The callback functions are optional. When a websocket event occurs, the
corresponding function will be evaluated if it exists.
The DATA parameter holds a raw vector with incoming data from broadcast
or receive events, and may be of length zero for other events.
The WS parameter is the client web socket corresponding to the event.
See the set_callback
function for more information.