public static TryParse ( string line, |
||
line | string | |
sseEvent | ||
리턴 | bool |
private void ProcessBuffer(int read) { lock (_lockObj) { _buffer.Add(_readBuffer, read); while (_buffer.HasChunks) { string line = _buffer.ReadLine(); // No new lines in the buffer so stop processing if (line == null) { break; } SseEvent sseEvent; if (!SseEvent.TryParse(line, out sseEvent)) { continue; } Debug.WriteLine("SSE READ: " + sseEvent); OnMessage(sseEvent); } } }
private void ProcessBuffer(ArraySegment <byte> readBuffer) { lock (BufferLock) { _buffer.Add(readBuffer); while (_buffer.HasChunks) { string line = _buffer.ReadLine(); // No new lines in the buffer so stop processing if (line == null) { break; } SseEvent sseEvent; if (!SseEvent.TryParse(line, out sseEvent)) { continue; } _connection.Trace(TraceLevels.Messages, "SSE: OnMessage({0})", sseEvent); OnMessage(sseEvent); } } }