Exemple #1
0
        public void Send(SseEvent @event)
        {
            var buffer            = BasicConsumerByteBuffer.Allocate(1, _maxMessageSize);
            var entity            = @event.Sendable();
            var withContentLength = Headers.Copy().And(ResponseHeader.WithContentLength(entity));
            var response          = Response.Of(Response.ResponseStatus.Ok, withContentLength, entity);

            _context.RespondWith(response.Into(buffer));
        }
        private void SendInitialResponse()
        {
            var response = Response.Of(Response.ResponseStatus.Ok, Headers.Copy());
            var buffer   = BasicConsumerByteBuffer.Allocate(1, _maxMessageSize);

            _context?.RespondWith(response.Into(buffer));
        }
Exemple #3
0
 private void SendInitialResponse()
 {
     try
     {
         var response = Response.Of(ResponseStatus.Ok, Headers.Copy());
         var buffer   = BasicConsumerByteBuffer.Allocate(1, _maxMessageSize);
         _context?.RespondWith(response.Into(buffer));
     }
     catch
     {
         // it's possible that I am being used for an unsubscribe
         // where the client has already disconnected and this
         // attempt will fail; ignore it and return.
     }
 }