public static ArraySegment<byte> CreateSendsMessage(ReceiverType type, List<PendingSend> sends) { MessageWriter writer = new MessageWriter(); writer.WriteSends(sends); ArraySegment<byte> sendsSegment = writer.GetSegment(); if (type != ReceiverType.HtmlFile) { return sendsSegment; } else { MessageWriter htmlFileWriter = new MessageWriter(); htmlFileWriter.WriteBytes(s_htmlFileSendMessagesStart); htmlFileWriter.WriteJsonString(new ArraySegment<byte>(sendsSegment.Array, sendsSegment.Offset, sendsSegment.Count - 1)); htmlFileWriter.WriteBytes(s_htmlFileSendMessagesEnd); return htmlFileWriter.GetSegment(); } }
public static ArraySegment<byte> CreateSockJSWebSocketSendMessage(ArraySegment<byte> buffer) { MessageWriter writer = new MessageWriter(); writer.WriteSockJSWebSocketSend(buffer); return writer.GetSegment(); }