eclipse-ee4j / jersey

Eclipse Jersey Project - Read our Wiki:
https://github.com/eclipse-ee4j/jersey/wiki
Other
681 stars 339 forks source link

Incorrect method in the documentation #3720

Open jerseyrobot opened 6 years ago

jerseyrobot commented 6 years ago

Hi

I followed this guide: https://jersey.github.io/documentation/latest/sse.html and this code example:

@GET
    @Produces(MediaType.SERVER_SENT_EVENTS)
    public void getServerSentEvents(@Context SseEventSink eventSink, @Context Sse sse) {
        new Thread(() -> {
            for (int i = 0; i < 10; i++) {
                // ... code that waits 1 second
                final OutboundSseEvent event = sse.newEventBuilder()
                    .name("message-to-client")
                    .data(String.class, "Hello world " + i + "!")
                    .build();
                eventSink.onNext(event);
            }
        }).start();
    }

However it seems to be outdated as eventSink doesn't have onNext method now. The replacement is send method that does the same.

jerseyrobot commented 6 years ago