private void ParseResponseBody(Reactor.Buffer buffer) { try { //--------------------------------------------- // checking the body of the response. The goal // here is to extract any frames passed on the // request from the server, as is the case with // socket.io. //--------------------------------------------- var data = buffer.ToString("utf8"); if (data.Contains("\r\n")) { var split = data.Split(new string[] { "\r\n\r\n" }, StringSplitOptions.RemoveEmptyEntries); if (split.Length == 2) { var bytes = buffer.ToArray(); //--------------------------------------------- // scan for frames //--------------------------------------------- var framedatalist = new List<List<byte>>(); List<byte> framedata = null; foreach (var b in bytes) { if (b == 0x81) { framedata = new List<byte>(); framedatalist.Add(framedata); } if (framedata != null) { framedata.Add(b); } } //--------------------------------------------- // add frame to frame list. //--------------------------------------------- foreach (var item in framedatalist) { var frame = Reactor.Web.Socket.Protocol.Frame.Parse(item.ToArray(), true); this.Frames.Add(frame); } } } } catch { } }