Skip to content

Commit

Permalink
docs: add dynamic example for changeable resolve
Browse files Browse the repository at this point in the history
closes #121
  • Loading branch information
pi0 committed Feb 10, 2025
1 parent 68264fd commit e5daf22
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/1.guide/6.resolver.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,17 @@ const websocket = crossws({
},
});
```

If you need to change resolve function (for cases like handling HMR):

```ts
let resolveWebSocketHooks = (req) => /* ... */

const websocket = crossws({
async resolve(req) {
return resolveWebSocketHooks(req)
},
});

// Update reference to `resolveWebSocketHooks` later.
```

0 comments on commit e5daf22

Please sign in to comment.