my.onSocketOpen

Use this API to listen to the event of enabling the WebSocket connection.

Sample Code

copy
my.connectSocket({
  url: 'test.php',
});

my.onSocketOpen(function(res) {
  console.log('The WebSocket connection is enabled!');
});

Note: The case is only for reference. Please use your own URL to test.

Parameters

PropertyType

Required

Description
callbackFunctionYesThe callback function for the event of enabling the WebSocket connection.