on method

void on(
  1. String event,
  2. SocketIOHandler handler
)

Subscribe to an event if the socket isConnected.

On event receive, the callback handler will be triggered.

Implementation

void on(String event, SocketIOHandler handler) {
  if (isConnected) _socket!.on(event, handler);
}