overwolf.web.websocket API
web.websocket
is an instance an Overwolf websocket. These can be created using the overwolf.web.createWebSocket()
method.
Note that it is best to use the native js WebSockets when you can.
Our web sockets by-pass cert checks for localhost WSS servers like LCU (league of legends).
Methods Reference
Events Reference
- overwolf.web.websocket.onMessage
- overwolf.web.websocket.onError
- overwolf.web.websocket.onOpen
- overwolf.web.websocket.onClosed
Types Reference
connect(callback)
Version added: 0.129
Listens for requests on the given port.
If the port is already in use, or this instance is already listening, an error will be returned.
Parameter | Type | Description |
---|---|---|
callback | (Result) => void | called with the status of the connection |
send(message, callback)
Version added: 0.129
send message.
If the port is already in use, or this instance is already listening, an error will be returned.
Parameter | Type | Description |
---|---|---|
message | string | Message to send |
callback | (Result) => void | A callback function which will be called with the status of the request |
close()
Version added: 0.129
Closes the websocket. It can be re-opened again.
onMessage()
Version added: 0.129
Fired when the websocket receives an incoming message, with the following structure: MessageEvent Object.
onError()
Version added: 0.129
Fired on error, with the following structure: ErrorEvent Object.
onOpen()
Version added: 0.129
Fired on websocket connection Opened.
onClosed()
Version added: 0.129
Fired when connection closed, with the following structure: onClosedEvent Object.
MessageEvent Object
Version added: 0.129
Container for the message event object.
Parameter | Type | Description |
---|---|---|
message | string | |
type | overwolf.web.enums.MessageType enum |
ErrorEvent Object
Version added: 0.129
Container for the error event object.
Parameter | Type | Description |
---|---|---|
message | string | |
exception | object |
onClosedEvent Object
Version added: 0.129
Container for the onClose event object.
Parameter | Type | Description |
---|---|---|
code | number | |
reason | string |