private void SendJsonMessage(Session session) { using (var writer = new HttpMessageWriter()) { //byte[] json = Encoding.UTF8.GetBytes(string.Format(@"{{id:{0}}}", session.Id)); byte[] json = Encoding.UTF8.GetBytes(string.Format(@"{0}", session.Id)); writer.WriteStatusLine(StatusCodes.OK); //writer.Write(Encoding.UTF8.GetBytes("Content-Type: application/json\r\n")); writer.WriteContentLength(json.Length); writer.WriteAccessControlHeaders(); writer.WriteCRLF(); writer.Write(json); SendWriter(session, writer); } }