private static Task PerformSend(object state)
        {
            var context = (ForeverFrameTransportContext)state;

            using (var htmlOutputWriter = new HTMLTextWriter(context.Transport.Pool))
            {
                htmlOutputWriter.WriteRaw("<script>r(c, ");
                context.Transport.JsonSerializer.Serialize(context.State, htmlOutputWriter);
                htmlOutputWriter.WriteRaw(");</script>\r\n");
                htmlOutputWriter.Flush();

                context.Transport.Context.Response.Write(htmlOutputWriter.Buffer);
            }

            return(context.Transport.Context.Response.Flush());
        }
        private static Task PerformKeepAlive(object state)
        {
            var transport = (ForeverFrameTransport)state;

            using (var htmlOutputWriter = new HTMLTextWriter(transport.Pool))
            {
                htmlOutputWriter.WriteRaw("<script>r(c, {});</script>");
                htmlOutputWriter.WriteLine();
                htmlOutputWriter.WriteLine();
                htmlOutputWriter.Flush();

                transport.Context.Response.Write(htmlOutputWriter.Buffer);
            }

            return(transport.Context.Response.Flush());
        }
Beispiel #3
0
        private static Task WriteInit(ForeverFrameTransportContext context)
        {
            context.Transport.Context.Response.ContentType = "text/html; charset=UTF-8";

            using (var htmlOutputWriter = new HTMLTextWriter(context.Transport.Pool))
            {
                htmlOutputWriter.NewLine = "\n";

                htmlOutputWriter.WriteRaw((string)context.State);
                htmlOutputWriter.Flush();

                context.Transport.Context.Response.Write(htmlOutputWriter.Buffer);
            }

            return(context.Transport.Context.Response.Flush());
        }
        private static Task WriteInit(ForeverFrameTransportContext context)
        {
            // Disable request compression
            var buffering = context.Transport.Context.GetFeature <IHttpBufferingFeature>();

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

            context.Transport.Context.Response.ContentType = "text/html; charset=UTF-8";

            using (var htmlOutputWriter = new HTMLTextWriter(context.Transport.Pool))
            {
                htmlOutputWriter.WriteRaw((string)context.State);
                htmlOutputWriter.Flush();

                context.Transport.Context.Response.Write(htmlOutputWriter.Buffer);
            }

            return(context.Transport.Context.Response.Flush());
        }
        private static Task PerformKeepAlive(object state)
        {
            var transport = (ForeverFrameTransport)state;

            using (var htmlOutputWriter = new HTMLTextWriter(transport.Pool))
            {
                htmlOutputWriter.NewLine = "\n";
                htmlOutputWriter.WriteRaw("<script>r(c, {});</script>");
                htmlOutputWriter.WriteLine();
                htmlOutputWriter.WriteLine();
                htmlOutputWriter.Flush();

                transport.Context.Response.Write(htmlOutputWriter.Buffer);
            }

            return transport.Context.Response.Flush();
        }
        private static Task PerformSend(object state)
        {
            var context = (ForeverFrameTransportContext)state;

            using (var htmlOutputWriter = new HTMLTextWriter(context.Transport.Pool))
            {
                htmlOutputWriter.NewLine = "\n";
                htmlOutputWriter.WriteRaw("<script>r(c, ");
                context.Transport.JsonSerializer.Serialize(context.State, htmlOutputWriter);
                htmlOutputWriter.WriteRaw(");</script>\r\n");
                htmlOutputWriter.Flush();

                context.Transport.Context.Response.Write(htmlOutputWriter.Buffer);
            }

            return context.Transport.Context.Response.Flush();
        }
        private static Task WriteInit(ForeverFrameTransportContext context)
        {
            context.Transport.Context.Response.ContentType = "text/html; charset=UTF-8";

            using (var htmlOutputWriter = new HTMLTextWriter(context.Transport.Pool))
            {
                htmlOutputWriter.NewLine = "\n";

                htmlOutputWriter.WriteRaw((string)context.State);
                htmlOutputWriter.Flush();

                context.Transport.Context.Response.Write(htmlOutputWriter.Buffer);
            }

            return context.Transport.Context.Response.Flush();
        }
        private static Task WriteInit(ForeverFrameTransportContext context)
        {
            // Disable request compression
            var buffering = context.Transport.Context.GetFeature<IHttpBufferingFeature>();
            if (buffering != null)
            {
                buffering.DisableRequestBuffering();
            }

            context.Transport.Context.Response.ContentType = "text/html; charset=UTF-8";

            using (var htmlOutputWriter = new HTMLTextWriter(context.Transport.Pool))
            {
                htmlOutputWriter.WriteRaw((string)context.State);
                htmlOutputWriter.Flush();

                context.Transport.Context.Response.Write(htmlOutputWriter.Buffer);
            }

            return context.Transport.Context.Response.Flush();
        }