addConnectionEventHandler method

void addConnectionEventHandler(
  1. String identifier,
  2. ConnectionEventHandler handler
)

~english Adds the connection event handler. After calling this method, you can handle new connection events when they arrive.

Param identifier The custom handler identifier, which is used to find the corresponding handler.

Param handler The handler for connection event. See ConnectionEventHandler. ~end

~chinese 添加连接状态监听事件。

Param identifier 监听事件对应 ID。

Param handler 监听的事件。 请见 ConnectionEventHandler。 ~end

Implementation

void addConnectionEventHandler(
  String identifier,
  ConnectionEventHandler handler,
) {
  _connectionEventHandler[identifier] = handler;
}