Azure / Azure/fetch-event-source

connection close event is fired shortly after connection

Open
#30 5 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
2.9k
Forks
196
PR merge metrics
No merged PRs in 30d

Description

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

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.