Class Handlers.SSE
Shortcut handlers for simulating a Server-Sent Events stream.
Inheritance
System.Object
Handlers.SSE
Namespace: LaunchDarkly.TestHelpers.HttpTest
Assembly: LaunchDarkly.TestHelpers.dll
Syntax
public static class SSE : Object
Methods
Comment(String)
Writes an SSE comment line.
Declaration
public static Handler Comment(string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | the content that should appear after the colon |
Returns
Type | Description |
---|---|
Handler | a Handler |
Event(String)
Writes an SSE event terminated by two newlines.
Declaration
public static Handler Event(string content)
Parameters
Type | Name | Description |
---|---|---|
System.String | content | the full event |
Returns
Type | Description |
---|---|
Handler | a Handler |
Event(String, String)
Writes an SSE event created from individual fields.
Declaration
public static Handler Event(string message, string data)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | the "event" field |
System.String | data | the "data" field |
Returns
Type | Description |
---|---|
Handler | a Handler |
LeaveOpen()
Waits indefinitely without closing the stream. Equivalent to Hang().
Declaration
public static Handler LeaveOpen()
Returns
Type | Description |
---|---|
Handler | a Handler |
Start()
Starts a chunked stream with the standard content type "text/event-stream", and the charset UTF-8.
Declaration
public static Handler Start()
Returns
Type | Description |
---|---|
Handler | a Handler |