-
-
Notifications
You must be signed in to change notification settings - Fork 33
WebSocket Class
wagyourtail edited this page Jul 23, 2020
·
6 revisions
the WebSocket class extends WebSocketClient
Example: new WebSocket(uri)
Initialize, to call this it is easiest to refer to Request.
put a function here for callback. Example:
ws.onOpen = (webSocket, handshake) => {
chat.log(handshake.getHttpStatusMessage());
}
put a function here for callback. Example:
ws.onMessage = (webSocket, message) => {
chat.log(message);
}
put a function here for callback. Example:
ws.onClose = (webSocket, closeData) => {
chat.log(closeData.reason);
}
put a function here for callback. Example:
ws.onClose = (webSocket, err) => {
chat.log(err);
}
class {
this.code; //int status code
this.reason; //string reason
this.remote; //boolean
constructor(code, reason, remote);
}