Handler webSocketHandler()

in lib/shelf_web_socket.dart [42:57]


Handler webSocketHandler(Function onConnection,
    {Iterable<String>? protocols,
    Iterable<String>? allowedOrigins,
    Duration? pingInterval}) {
  if (onConnection is! void Function(Null, Null)) {
    final innerOnConnection = onConnection;
    onConnection = (webSocket, _) => innerOnConnection(webSocket);
  }

  return WebSocketHandler(
    onConnection,
    protocols?.toSet(),
    allowedOrigins?.map((origin) => origin.toLowerCase()).toSet(),
    pingInterval,
  ).handle;
}