connect method

  1. @override
Future<WebSocketConnection> connect(
  1. HttpRequest request, [
  2. WebSocketConnectionRequest? connectionRequest
])
override

Implementation

@override
Future<WebSocketConnection> connect(HttpRequest request,
    [WebSocketConnectionRequest? connectionRequest]) async {
  if (connectionRequest == null) {
    throw UnauthorizedException();
  }

  var socket = await WebSocketTransformer.upgrade(request);

  return WebSocketConnection(
      socket: socket,
      id: request.connectionInfo!.remoteAddress.host,
      token: connectionRequest.token);
}