Open cubecleveland opened 2 years ago
Hi @cubecleveland,
Unfortunately, I don't know enough about SSE to answer this question. If you can provide a code example, I can take a look.
Thanks so much for the answer!
Im really just using the same example from the docs.
const { lastEvent, getEventSource, readyState } = useEventSource( 'http://localhost:3000/', { withCredentials: true, events: { message: (messageEvent) => { console.log('This has type "message": ', messageEvent); }, update: (messageEvent) => { console.log('This has type "update": ', messageEvent); }, }, } );
This works great. Problem is on a SAP in react when the server is lets say down.... or you are not authenticated.... the Event source is not getting connected...
I want to basically re-initate the call and make the libaray open another EventStream if connection fails...
thought about using a setInterval to reconnect but how do i use the same EventStream Object.. Hope all this make sense...
CAn u guide me to the piece of code wheer the Eventstream is being created we might be able to contribute apiece to handle my use case..
Hello, im tryin to initiate a reconnect for the useEventSource using Event stream. Problem is that sometime the Server has high traffic and shuts the connection,
Is there any hthing i can do to reinitalize the EventStream to reopen the connection ?