Example #1
0
        private static Task WriteInit(ForeverFrameTransportContext context)
        {
            context.Transport.Context.Response.ContentType = "text/html; charset=UTF-8";

            context.Transport.HTMLOutputWriter.WriteRaw((string)context.State);
            context.Transport.HTMLOutputWriter.Flush();

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

            var initContext = new ForeverFrameTransportContext(context.Transport, context.State);

            // Ensure delegate continues to use the C# Compiler static delegate caching optimization.
            return(WriteInit(initContext));
        }
        public override Task Send(PersistentResponse response)
        {
            OnSendingResponse(response);

            var context = new ForeverFrameTransportContext(this, response);

            // Ensure delegate continues to use the C# Compiler static delegate caching optimization.
            return(EnqueueOperation(s => PerformSend(s), context));
        }
        public override Task Send(PersistentResponse response)
        {
            OnSendingResponse(response);

            var context = new ForeverFrameTransportContext(this, response);

            // Ensure delegate continues to use the C# Compiler static delegate caching optimization.
            return EnqueueOperation(s => PerformSend(s), context);
        }
Example #5
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());
        }
        protected internal override Task InitializeResponse(ITransportConnection connection)
        {
            uint frameId;
            string rawFrameId = Context.Request.QueryString["frameId"];
            if (String.IsNullOrWhiteSpace(rawFrameId) || !UInt32.TryParse(rawFrameId, NumberStyles.None, CultureInfo.InvariantCulture, out frameId))
            {
                // Invalid frameId passed in
                throw new InvalidOperationException(Resources.Error_InvalidForeverFrameId);
            }

            string initScript = _initPrefix +
                                frameId.ToString(CultureInfo.InvariantCulture) +
                                _initSuffix;

            var context = new ForeverFrameTransportContext(this, initScript);

            // Ensure delegate continues to use the C# Compiler static delegate caching optimization.
            return base.InitializeResponse(connection).Then(s => Initialize(s), context);
        }
        protected internal override Task InitializeResponse(ITransportConnection connection)
        {
            uint   frameId;
            string rawFrameId = Context.Request.Query["frameId"];

            if (String.IsNullOrWhiteSpace(rawFrameId) || !UInt32.TryParse(rawFrameId, NumberStyles.None, CultureInfo.InvariantCulture, out frameId))
            {
                // Invalid frameId passed in
                throw new InvalidOperationException(Resources.Error_InvalidForeverFrameId);
            }

            string initScript = _initPrefix +
                                frameId.ToString(CultureInfo.InvariantCulture) +
                                _initSuffix;

            var context = new ForeverFrameTransportContext(this, initScript);

            // Ensure delegate continues to use the C# Compiler static delegate caching optimization.
            return(base.InitializeResponse(connection).Then(s => Initialize(s), context));
        }
        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 Initialize(object state)
        {
            var context = (ForeverFrameTransportContext)state;

            var initContext = new ForeverFrameTransportContext(context.Transport, context.State);

            // Ensure delegate continues to use the C# Compiler static delegate caching optimization.
            return context.Transport.EnqueueOperation(s => WriteInit(s), initContext);
        }
        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)
        {
            context.Transport.Context.Response.ContentType = "text/html; charset=UTF-8";

            context.Transport.HTMLOutputWriter.WriteRaw((string)context.State);
            context.Transport.HTMLOutputWriter.Flush();

            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();
        }