Beispiel #1
0
 public UnaryMethodCall(Func <ValueTask <IOutcomingInvocation <TRequest, TResponse> > > invocationFactory)
 {
     _invocationFactory = invocationFactory;
     Completion.LogCompletion(Log);
     ResponseAsync = Completion.ContinueWithSynchronously(t =>
     {
         t.GetResult();
         return(_response);
     });
 }
        public WebSocketClientTransmissionConnection(string url)
        {
            _log = LogManager.GetLogger <WebSocketClientTransmissionConnection>(Id.ToString());
            _disconnectCompletion.Task.PropagateCompletionToPromise(_connectCompletion);
            _webSocket         = new WebSocket(url.Replace("http://", "ws://"));
            _webSocket.Opened += OnOpened;
            _webSocket.Closed += OnClosed;
            _webSocket.Error  += OnError;

            _reader = new WebSocketClientTransmissionReader(Id, _webSocket, CancellationToken);
            _writer = new WebSocketClientTransmissionWriter(Id, _webSocket, CancellationToken);

            Completion.LogCompletion(_log);

            _log.Trace("Created");
        }
        public WebSocketServerTransmissionConnection(IWebSocketConnection websocket)
        {
            _log       = LogManager.GetLogger <WebSocketServerTransmissionConnection>(Id.ToString());
            _webSocket = websocket;
            _disconnectCompletion.Task.PropagateCompletionToPromise(_connectCompletion);

            _reader = new WebSocketServerTransmissionReader(Id, _webSocket, CancellationToken);
            _writer = new WebSocketServerTransmissionWriter(Id, _webSocket, CancellationToken);

            _webSocket.OnOpen  += OnOpened;
            _webSocket.OnClose += OnClosed;
            _webSocket.OnError += OnError;

            Completion.LogCompletion(_log);

            _log.Trace("Created");
        }
        public WebSocketClientTransmissionConnection(string url)
        {
            _log = LogManager.GetLogger <WebSocketClientTransmissionConnection>(Id.ToString());
            _disconnectCompletion.Task.PropagateCompletionToPromise(_connectCompletion);
            _webSocket                      = new WebSocket(url.Replace("http://", "ws://"));
            _webSocket.Opened              += OnOpened;
            _webSocket.Closed              += OnClosed;
            _webSocket.Error               += OnError;
            _webSocket.NoDelay              = true;
            _webSocket.EnableAutoSendPing   = true;
            _webSocket.AutoSendPingInterval = 5000;
            _webSocket.ReceiveBufferSize    = PooledBuffer.MaxSize;

            _reader = new WebSocketClientTransmissionReader(Id, _webSocket, CancellationToken);
            _writer = new WebSocketClientTransmissionWriter(Id, _webSocket, CancellationToken);

            Completion.LogCompletion(_log);

            _log.Trace("Created");
        }
Beispiel #5
0
 protected StartableBase(ILogger log = null)
 {
     _startTaskLazy = new Lazy <Task>(StartCoreAsync);
     _log           = log ?? LogManager.GetLogger(GetType(), "StartableBase");
     Completion.LogCompletion(_log);
 }
Beispiel #6
0
 public ServerStreamingMethodCall(Func <ValueTask <IOutcomingInvocation <TRequest, TResponse> > > invocationFactory)
 {
     _invocationFactory = invocationFactory;
     Completion.LogCompletion(Log);
     _responseStream.PropagateCompletionFrom(Completion);
 }
 public ClientStreamingMethodCall(Func <ValueTask <IOutcomingInvocation <TRequest, TResponse> > > invocationFactory)
 {
     _invocationFactory = invocationFactory;
     Completion.LogCompletion(Log);
 }