Skip to main content

overwolf.web.websocket API

note

web.websocket is an instance an Overwolf websocket. These can be created using the overwolf.web.createWebSocket() method.

tip

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

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.

ParameterTypeDescription
callback(Result) => voidcalled 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.

ParameterTypeDescription
messagestringMessage to send
callback(Result) => voidA 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.

ParameterTypeDescription
messagestring
typeoverwolf.web.enums.MessageType enum

ErrorEvent Object

Version added: 0.129

Container for the error event object.

ParameterTypeDescription
messagestring
exceptionobject

onClosedEvent Object

Version added: 0.129

Container for the onClose event object.

ParameterTypeDescription
codenumber
reasonstring