Ejemplo n.º 1
0
        private static Task WriteInit(ServerSentEventsTransport transport)
        {
            // Disable request compression
            var buffering = transport.Context.Features.Get <IHttpBufferingFeature>();

            if (buffering != null)
            {
                buffering.DisableRequestBuffering();
            }

            transport.Context.Response.ContentType = "text/event-stream";

            // "data: initialized\n\n"
            transport.Context.Response.Write(new ArraySegment <byte>(_dataInitialized));

            return(transport.Context.Response.Flush());
        }
        private static Task WriteInit(ServerSentEventsTransport transport)
        {
            // Disable request compression
            var buffering = transport.Context.Features.Get<IHttpBufferingFeature>();
            if (buffering != null)
            {
                buffering.DisableRequestBuffering();
            }

            transport.Context.Response.ContentType = "text/event-stream";

            // "data: initialized\n\n"
            transport.Context.Response.Write(new ArraySegment<byte>(_dataInitialized));

            return transport.Context.Response.Flush();
        }
Ejemplo n.º 3
0
 public SendContext(ServerSentEventsTransport transport, object state)
 {
     Transport = transport;
     State     = state;
 }
 public SendContext(ServerSentEventsTransport transport, object state)
 {
     Transport = transport;
     State = state;
 }