fetch-event-source
fetch-event-source copied to clipboard
connection close event is fired shortly after connection
trafficstars
Hello ,
I tried the same server side code and client side with this package and default event source . i see that server is getting close event as soon as connection is established . Just to make sure that my Server side code is not the issue I changed the client code to native event source and i cam seeing that it works as expected . i am interested to send header and other good things that this Package has . Can any one help me
My client side code (removed all other codes just to keep simple ) wrapped in useEffect reactHook
const fetchData = async () => {
await fetchEventSource(`${serverBaseURL}`, {
method: "POST",
body: JSON.stringify({ userName, uniqueUserIdentifier }),
headers: {
Accept: "text/event-stream",
},
openWhenHidden: true,
onclose() {
console.log("Connection closed by the server");
},
});
};
fetchData();
}, []);
any update for this issue? i have the same prob
same prob too