You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello
at the Browser like (chrome) its possible to close active opened event-source by just close the Browser,
now I have a server allow only 1 concurrent SSE , so only one client (session) is allowed,
for example if you tried to open new tab in browser, you will not able to call same link of Events twice (only 1 client/session is allowed)
first question is: How to close current active EventSource , for example evtSource.close() ??
second question, how to monitor current status of event-source (readyState) , for example at html version:
The readyState read-only property of the [EventSource] interface returns a number representing the state of the connection
A number which is one of the three possible state constants defined on the [EventSource] interface:
EventSource.CONNECTING (0)
The connection is not yet open.
EventSource.OPEN] (1)
The connection is open and ready to communicate.
EventSource.CLOSED (2)
The connection is closed or couldn't be opened.
Hello
at the Browser like (chrome) its possible to close active opened event-source by just close the Browser,
now I have a server allow only 1 concurrent SSE , so only one client (session) is allowed,
for example if you tried to open new tab in browser, you will not able to call same link of Events twice (only 1 client/session is allowed)
first question is: How to close current active EventSource , for example evtSource.close() ??
second question, how to monitor current status of event-source (readyState) , for example at html version:
The readyState read-only property of the [EventSource] interface returns a number representing the state of the connection
A number which is one of the three possible state constants defined on the [EventSource] interface:
EventSource.CONNECTING (0)
The connection is not yet open.
EventSource.OPEN] (1)
The connection is open and ready to communicate.
EventSource.CLOSED (2)
The connection is closed or couldn't be opened.
[Examples]
const evtSource = new EventSource("sse.php");
console.log(evtSource.readyState);
ref:
https://developer.mozilla.org/en-US/docs/Web/API/EventSource/readyState
The text was updated successfully, but these errors were encountered: