private async void HandleHTTPResponse()
        {
            // STEP 6: Read and parse the HTTP response
            Log.To.Sync.V(Tag, "WebSocket sent HTTP request...");
            try {
                using (var streamReader = new StreamReader(NetworkStream, Encoding.ASCII, false, 5, true)) {
                    var parser = new HttpMessageParser(await streamReader.ReadLineAsync().ConfigureAwait(false));
                    while (true)
                    {
                        var line = await streamReader.ReadLineAsync().ConfigureAwait(false);

                        if (String.IsNullOrEmpty(line))
                        {
                            break;
                        }

                        parser.Append(line);
                    }

                    ReceivedHttpResponse(parser);
                }
            } catch (Exception e) {
                Log.To.Sync.I(Tag, "Error reading HTTP response of websocket handshake", e);
                DidClose(e);
            }
        }
Пример #2
0
        private async void HandleHTTPResponse()
        {
            Log.To.Sync.V(Tag, "WebSocket sent HTTP request...");

            using (var streamReader = new StreamReader(NetworkStream, Encoding.ASCII, false, 5, true)) {
                var parser = new HttpMessageParser(await streamReader.ReadLineAsync().ConfigureAwait(false));
                while (true)
                {
                    var line = await streamReader.ReadLineAsync().ConfigureAwait(false);

                    if (String.IsNullOrEmpty(line))
                    {
                        break;
                    }

                    parser.Append(line);
                }

                ReceivedHttpResponse(parser);
            }
        }