connect method

Future<void> connect()

Implementation

Future<void> connect() async {
  var userId = await _generateRandomId(IdentifierType.userId);
  var sessionId = await _generateRandomId(IdentifierType.sessionId);

  channel = WebSocketChannel.connect(
    Uri.parse('${SocketUrls.baseSocketEndpoint}$userId/$sessionId'),
  );

  if (controller == null || controller!.isClosed) {
    controller = StreamController();
  }
  if (kDebugMode) {
    print('${SocketUrls.baseSocketEndpoint}$userId/$sessionId');
  }
}