-
Notifications
You must be signed in to change notification settings - Fork 43
Description
@EmilJunker When using our SSE endpoint with timeout, interval, and times, the client experiences a long delay before connecting. Once connected, all messages are delivered at once rather than at the specified interval. The expected behavior is that the client connects quickly and receives one message per interval until the timeout is reached, at which point the connection closes.
Steps to Reproduce:
- Call the SSE endpoint with these params (example):
- timeout=10000 (10s)
- interval=1000 (1s)
- times=5
- Observe that the connection takes a while to open.
- Once open, messages arrive in bulk instead of at each interval.
Expected Behavior:
- Quick connection to the SSE stream.
- Each message arrives separately according to the set interval.
- Connection closes automatically at the end of the timeout.
Actual Behavior:
- Delayed connection.
- All messages are sent simultaneously instead of per interval.
Stack:
- Expo : "~51.0.39"
- react-native-sse: "^1.2.1",
- react-native: "0.74.5"
This testing endpoint also gets a big delay to connect !
https://stream.wikimedia.org/v2/stream/recentchange
My Code:
useEffect(() => {
const url = ${API_URL}/sse/test/${currentUserId}?timeout=10000&interval=1000×=5;
eventSource = new EventSource(url);
eventSource.addEventListener("open", () => {
console.log("connected");
});
eventSource.addEventListener("message", event => {
console.log("event.data", event.data);
});
eventSource.addEventListener("close", () => {
console.log("close");
});
});