Inheritance: MemoryPoolTextWriter, IBinaryWriter
        private static Task PerformSend(object state)
        {
            var context = (SendContext)state;

            using (var writer = new BinaryMemoryPoolTextWriter(context.Transport.Pool))
            {
                writer.Write("data: ");
                context.Transport.JsonSerializer.Serialize(context.State, writer);
                writer.WriteLine();
                writer.WriteLine();
                writer.Flush();

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

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

            if (!context.Transport.IsAlive)
            {
                return TaskAsyncHelper.Empty;
            }

            using (var writer = new BinaryMemoryPoolTextWriter(context.Transport.Pool))
            {
                if (context.Transport.IsJsonp)
                {
                    writer.Write(context.Transport.JsonpCallback);
                    writer.Write("(");
                }

                context.Transport.JsonSerializer.Serialize(context.State, writer);

                if (context.Transport.IsJsonp)
                {
                    writer.Write(");");
                }

                writer.Flush();

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

            return context.Transport.Context.Response.Flush();
        }
        private static async Task PerformSend(object state)
        {
            var context = (WebSocketTransportContext)state;
            var socket = context.Transport._socket;

            using (var writer = new BinaryMemoryPoolTextWriter(context.Transport.Pool))
            {
                try
                {
                    context.Transport.JsonSerializer.Serialize(context.State, writer);
                    writer.Flush();

                    await socket.Send(writer.Buffer).PreserveCulture();
                }
                catch (Exception ex)
                {
                    // OnError will close the socket in the event of a JSON serialization or flush error.
                    // The client should then immediately reconnect instead of simply missing keep-alives.
                    context.Transport.OnError(ex);
                    throw;
                }
            }
        }
        private static Task PerformSend(object state)
        {
            var context = (ForeverTransportContext)state;

            if (!context.Transport.IsAlive)
            {
                return TaskAsyncHelper.Empty;
            }

            context.Transport.Context.Response.ContentType = JsonUtility.JsonMimeType;

            using (var writer = new BinaryMemoryPoolTextWriter(context.Transport.Pool))
            {
                context.Transport.JsonSerializer.Serialize(context.State, writer);
                writer.Flush();

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

            return TaskAsyncHelper.Empty;
        }