src/LaunchDarkly.EventSource/EventParser.cs
/// <summary>
/// Gets the field and value from a server sent event message.
/// </summary>
/// <remarks>
/// For processing server sent event messages, see the documentation titled <a href="https://html.spec.whatwg.org/multipage/server-sent-events.html#processField">Process the Field</a>
/// </remarks>
/// <param name="value">The server sent event message.</param>
/// <returns></returns>
Gets the field and value from a server sent event message.
Gets the field and value from a server sent event message .
public static KeyValuePair<string, string> GetFieldFromLine(string value)
        {
            if (!ContainsField(value)) return new KeyValuePair<string, string>();
            var colonIndex = value.IndexOf(":", StringComparison.Ordinal);
            var fieldName = value.Substring(0, colonIndex);
            var fieldValue = value.Substring(colonIndex + 1).TrimStart(' ');
            return new KeyValuePair<string, string>(fieldName, fieldValue);
        }
public static KeyValuePair < string , string > GetFieldFromLine ( string value ) { if ( ! ContainsField ( value ) ) return new KeyValuePair < string , string > ( ) ; var colonIndex = value . IndexOf ( " " , StringComparison . Ordinal ) ; var fieldName = value . Substring ( 0 , colonIndex ) ; var fieldValue = value . Substring ( colonIndex + 1 ) . TrimStart ( ' ' ) ; return new KeyValuePair < string , string > ( fieldName , fieldValue ) ; }
Gets the field and value from a server sent event message.
Gets the field and value from a server sent event message .
None
value
string
The server sent event message.
The server sent event message .
remarks
For processing server sent event messages, see the documentation titled Process the Field
For processing server sent event messages see the documentation titled Process the Field