Skip to content

Commit 416e593

Browse files
authored
docs: add docs for augmenting PeerContext type (#161)
1 parent c33d867 commit 416e593

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

docs/1.guide/3.peer.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@ Direct access to the [`WebSocket`](https://developer.mozilla.org/en-US/docs/Web/
3939

4040
The context is an object that contains arbitrary information about the request.
4141

42+
You can augment the `PeerContext` interface types to add your properties.
43+
44+
```ts
45+
declare module "crossws" {
46+
interface PeerContext {
47+
customData?: string[];
48+
}
49+
}
50+
```
51+
4252
> [!NOTE]
4353
> context data can be volatile in some runtimes.
4454

0 commit comments

Comments
 (0)