Skip to content

Big Delays and Sends Messages in Bulk Instead of Streaming #74

@kheireddinebou

Description

@kheireddinebou

@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:

  1. Call the SSE endpoint with these params (example):
    • timeout=10000 (10s)
    • interval=1000 (1s)
    • times=5
  2. Observe that the connection takes a while to open.
  3. 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&times=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");
});

});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions