wsStream method

Route wsStream(
  1. String path,
  2. WsOnConnect onConnect, {
  3. Map<String, String>? pathRegEx,
  4. List<RouteInterceptor>? after,
  5. List<RouteInterceptor>? before,
  6. List<ExceptionHandler>? onException,
})

Example: server.wsStream('/ws', (ctx, ws) => Stream.periodic);

Implementation

Route wsStream(
    String path, WsOnConnect /* < Stream<T> | Response > */ onConnect,
    {Map<String, String>? pathRegEx,
    List<RouteInterceptor>? after,
    List<RouteInterceptor>? before,
    List<ExceptionHandler>? onException}) {
  return addRoute(Route.get(path, ws.wsStream(onConnect),
      pathRegEx: pathRegEx,
      before: before,
      after: after,
      onException: onException));
}