/// <summary> /// Begins listening for incoming requests over this StreamingRequestHandler's server. /// </summary> /// <returns>A task that completes once the server is no longer listening.</returns> public async Task ListenAsync() { await _server.StartAsync().ConfigureAwait(false); _logger.LogInformation("Streaming request handler started listening"); // add ourselves to a global collection to ensure a reference is maintained if we are connected _requestHandlers.TryAdd(_instanceId, this); }
/// <inheritdoc /> public override async Task ListenAsync(RequestHandler requestHandler, CancellationToken cancellationToken = default) { _server = CreateStreamingTransportServer(requestHandler); _serverIsConnected = true; _server.Disconnected += Server_Disconnected; if (_onServerDisconnect != null) { _server.Disconnected += _onServerDisconnect; } await _server.StartAsync().ConfigureAwait(false); }
#pragma warning restore CA1056 // Uri properties should not be strings /// <summary> /// Begins listening for incoming requests over this StreamingRequestHandler's server. /// </summary> /// <returns>A task that completes once the server is no longer listening.</returns> public async Task ListenAsync() { await _server.StartAsync().ConfigureAwait(false); _logger.LogInformation("Streaming request handler started listening"); }
/// <summary> /// Connects the handler to a WebSocket server and begins listening for incoming requests. /// </summary> /// <param name="socket">The socket to use when creating the server.</param> /// <returns>A task that runs until the server is disconnected.</returns> public Task StartAsync(WebSocket socket) { _transportServer = new WebSocketServer(socket, this); return(_transportServer.StartAsync()); }
/// <summary> /// Connects the handler to a Named Pipe server and begins listening for incoming requests. /// </summary> /// <param name="pipeName">The name of the named pipe to use when creating the server.</param> /// <returns>A task that runs until the server is disconnected.</returns> public Task StartAsync(string pipeName) { _transportServer = new NamedPipeServer(pipeName, this); return(_transportServer.StartAsync()); }