Gets as any arguments as it needs
Creates an event emitter instance to listen for the actions
Call the function to remove the event
Creates an event emitter instance to listen for the actions
Call the function to remove the event
Gets as any arguments as it needs
Creates an event emitter instance to listen for the actions
Call the function to remove the event
Removes the specified event and invokes the callback after it is removed
Optional
callback: EventListenerCallbackAdds the listener function to the beginning of the listeners array for the event named eventName. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of eventName and listener will result in the listener being added, and called, multiple times.
Adds a one-time listener function for the event named eventName to the beginning of the listeners array. The next time eventName is triggered, this listener is removed, and then invoked.
Readonly
headersGets headers of socket connection. If you want to change the headers, you have to call the constructor again (create a new instance).
1.1.17
Readonly
urlGets url of socket connection. If you want to change the URL, you have to call the constructor again (create a new instance).
1.1.17
Invoked when a web socket has been accepted by the web socket server.
1.1.17
import WebSocket from '@smartface/native/net/websocket';
const webSocket = new WebSocket();
webSocket.on(WebSocket.Events.Open, () => {
console.info('onOpen');
});
Invoked when a message has been received.
1.1.17
import WebSocket from '@smartface/native/net/websocket';
const webSocket = new WebSocket();
webSocket.on('message', (params) => {
console.info('onMessage', params);
});
Optional
string?: stringOptional
blob?: BlobImplInvoked when the web socket has been closed.
1.1.17
import WebSocket from '@smartface/native/net/websocket';
const webSocket = new WebSocket();
webSocket.on('close', (params) => {
console.info('onClose', params);
});
Invoked when an error occured on reading or writing to the network.
1.1.17
import WebSocket from '@smartface/native/net/websocket';
const webSocket = new WebSocket();
webSocket.on('failure', (params) => {
console.info('onFailure', params);
});
Generated using TypeDoc
Creates an event emitter instance to listen for the actions
Returns
Call the function to remove the event