Skip to content

Commit 8f4e5cd

Browse files
authored
docs: move out stream example from testing (#325)
1 parent db19ca0 commit 8f4e5cd

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

README.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -263,14 +263,6 @@ fastify.register(require('@fastify/websocket'), {
263263
})
264264
```
265265

266-
### Testing
267-
268-
Testing the ws handler can be quite tricky, luckily `fastify-websocket` decorates fastify instance with `injectWS`,
269-
which allows easy testing of a websocket endpoint.
270-
271-
The signature of injectWS is the following: `([path], [upgradeContext])`.
272-
273-
274266
### Creating a stream from the WebSocket
275267

276268
```js
@@ -296,6 +288,13 @@ fastify.get('/', { websocket: true }, (socket, req) => {
296288
await fastify.listen({ port: 3000 })
297289
```
298290

291+
### Testing
292+
293+
Testing the ws handler can be quite tricky, luckily `fastify-websocket` decorates fastify instance with `injectWS`,
294+
which allows easy testing of a websocket endpoint.
295+
296+
The signature of injectWS is the following: `([path], [upgradeContext])`.
297+
299298
#### App.js
300299

301300
```js

0 commit comments

Comments
 (0)