- Introduction
- Quick start
- Philosophy
- Comparison
- Default behaviors
- Limitations
- Debugging runbook
- FAQ
- Mocking HTTP
- Mocking SSE
- Mocking GraphQL
- Mocking WebSocket
- Integrations
- API
- CLI
- Best practices
- Recipes
Retry
Mocking the reconnection time.
You can mock the reconnection time instruction from the server by sending the retry message to the client. The value of the retry key will control the reconnection time if the underlying connection is lost.
import { sse } from 'msw'
export const handlers = [
sse('/stream', ({ client }) => {
client.send({ retry: 1000 })
}),
]If present, the retry key must be the only key on the object provided to
client.send(). All the other keys will be ignored.
This will result in the following message received by the client:
retry:1000