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 })
  }),
]

This will result in the following message received by the client:

retry:1000