my.onSocketError
Use this API to listen to WebSocket error events.
Sample Code
copy
my.connectSocket({
url: 'Developer's server URL'
});
my.onSocketOpen(function(res){
console.log('The WebSocket connection is enabled!');
});
my.onSocketError(function(res){
console.log('The WebSocket connection failed. Please check!');
});
Note:The case is only for reference. Please use your own URL to test.
Parameters
Property | Type | Required | Description |
callback | Function | Yes | The callback function for the WebSocket error event. |