websocketDebugMiddleware function

Middleware websocketDebugMiddleware()

Websocket debug middleware

Implementation

Middleware websocketDebugMiddleware() {
  return (HttpRequest request, Function next) async {
    await next();
    for (final socket in debugSockets) {
      if (socket.readyState == WebSocket.open) {
        socket.add(jsonEncode(logs.last));
      }
    }
  };
}