You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api.md
+8-1Lines changed: 8 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -41,6 +41,7 @@ Note that creating a new session will immediately send the initial status code a
41
41
|`keepAlive`|`number`\|`null`|`10000`|Time in milliseconds interval for the session to send a comment to keep the connection alive.<br><br>Give as `null` to disable the keep-alive mechanism.|
42
42
|`statusCode`|`number`|`200`|Status code to be sent to the client.<br><br>Event stream requests can be redirected using HTTP 301 and 307 status codes. Make sure to set `Location` header when using these status codes (301/307) using the `headers` property.<br><br>A client can be asked to stop reconnecting by send a 204 status code.|
43
43
|`headers`|`object`|`{}`|Additional headers to be sent along with the response.|
44
+
|`state`|`object`|`{}`|Initial custom state for the session.<br><br>Accessed via the [`state`](#sessionstate-state) property.<br><br>When using TypeScript, providing the initial state structure allows the type of the `state` property to be automatically inferred.|
44
45
45
46
#### `Session#lastId`: `string`
46
47
@@ -174,7 +175,13 @@ A `Channel` is used to broadcast events to many sessions at once.
174
175
You may use the second generic argument `SessionState` to enforce that only sessions
175
176
with the same state type may be registered with this channel.
`options` is an object with the following properties:
181
+
182
+
|Property|Type|Default|Description|
183
+
|-|-|-|-|
184
+
|`state`|`object`|`{}`|Initial custom state for the channel.<br><br>Accessed via the [`state`](#channelstate-state) property.<br><br>When using TypeScript, providing the initial state structure allows the type of the `state` property to be automatically inferred.|
0 commit comments