internal RelayConnection(RelayServer server, WebSocketClient socket, int id) { _server = server; _socket = socket; _cancelToken = new CancellationTokenSource(); _inBuffer = new byte[4000]; _outBuffer = new byte[4000]; _logger = server.LogManager.CreateLogger($"Client #{id}"); }
public static void UseDiscordRelay(this IApplicationBuilder app, Action <RelayServer> configAction = null) { var server = new RelayServer(configAction); server.StartAsync(); app.Use(async(context, next) => { if (context.WebSockets.IsWebSocketRequest) { await server.AcceptAsync(context); } await next(); }); }