jersey
  1. jersey
  2. JERSEY-2046

SSE: The events sent to clients are not in real time

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Works as designed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.3
    • Component/s: media
    • Labels:
      None

      Description

      I have a SSE resource method as below. I wanted to send an event in every second.

        for (int i = 1; i <= 10; i++) { 
          ... 
          OutboundEvent.Builder eb = new OutboundEvent.Builder(); 
          eventOutput.write(eb.id(sdf.format(new Date())) 
                              .data(Integer.class, i) 
                              .build()); 
          Thread.sleep(1000); 
          ... 
        }
      

      After I deploy it to WLS and initiate a request to this SSE resource using a web browser or curl, I found that the client can not see anything before all the events are generated. In other words, the client can not receive the event in real time.

        Activity

        Hide
        Marek Potociar added a comment -

        The event source will not be able to send any events until it is returned from the resource method. This is by design. Closing the issue.

        Show
        Marek Potociar added a comment - The event source will not be able to send any events until it is returned from the resource method. This is by design. Closing the issue.

          People

          • Assignee:
            Marek Potociar
            Reporter:
            Michal Gajdos
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: