Table of Contents
WebsocketConnection
Encapsulates a websocket connection
Wraps a Websocket connection with a logger.
Parameters
host
string A websocket url, e.g. 'ws://demos.kaazing.com/echo'log
Log An object which has alog()
function
Examples
; { console; } let logger = ;let connection = 'ws://demos.kaazing.com/echo' logger; connection console;connection console; connection;
onOpen
onClose
Type: Callback
onError
Type: Callback
Parameters
e
onMessage
Type: Callback
Parameters
m
connect
Starts the connection process
close
Closes the current connection
send
Sends a binary payload
Parameters
payload
(Uint8Array | Blob)