onConnected method

  1. @override
void onConnected(
  1. WebSocketChannel webSocket
)
override

WebSocketProvider

Implementation

@override
void onConnected(WebSocketChannel webSocket) {
  logger.i('设备已连接到: ${CanaryWebSocket.instance.url}');
  channel = webSocket;
  _timer = Timer.periodic(const Duration(seconds: 10), (timer) {
    _count++;
    channel.send(OpCode.ping, _count.bytes());
  });
  register();
}