Skip to content

Commit ec6ec59

Browse files
committed
docs(api): add fetch api changes to createSession api reference
1 parent 3ddb33b commit ec6ec59

File tree

1 file changed

+6
-1
lines changed
  • docs/src/content/docs/reference

1 file changed

+6
-1
lines changed

docs/src/content/docs/reference/api.mdx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,15 @@ createSession(Request, Response, SessionOptions?): Promise<Session>
152152
createSession(Request, SessionOptions?): Promise<Session>
153153
```
154154
155-
Creates and returns a promise that resolves to an instance of a [Session](#session) once it has connected.
155+
Create a new [`Session`](#sessionstate).
156156
157157
Takes the [same arguments as the Session class constructor](#new-sessionstate--defaultsessionstatereq-incomingmessage--http2serverrequest--request-res-serverresponse--http2serverresponse--response--sessionoptions-options-sessionoptions).
158158
159+
When using the Fetch API, resolves immediately with a session instance before it has connected.<br />
160+
You can listen for the `connected` event on the session to know when it has connected, or otherwise use the shorthand `createResponse` function that does so for you instead.
161+
162+
When using the Node HTTP APIs, waits for the session to connect before resolving with its instance.
163+
159164
### `createResponse`: `<State>(...args: ConstructorParameters<typeof Session>, callback: (session: Session<State>) => void) => Response`
160165
161166
*Overloads:*

0 commit comments

Comments
 (0)