reta commented on pull request #813:
URL: https://github.com/apache/cxf/pull/813#issuecomment-857325700


   Thanks for the PR, @timothyjward , I believe we should take a step back and 
think about what we would like to implement first. So we want to provide the 
option to use POST for SSE events but the `SseEventSource` is GET-oriented and 
does not have the means to provide the request payload: this is by design and I 
believe we should not alter that anyhow. This is what the consumer of this API 
would expect. Probably, the conclusion is we have to define the APIs which 
would explicitly model SSE-over-POST, it should not be squeezed into 
`SseEventSource`. May be something along these lines:
   
   ```
   public interface SsePostEventSource<?> {
       void open(Entity<?> payload);
       void close();
       boolean isOpen();
       void register(Consumer<InboundSseEvent> onEvent);
       ...
   }
   ```
   
   Now, the important question is: what should happen on reconnect? Should the 
same request payload be sent to the endpoint over and over again? Or should it 
be up to consumer to decide? I inclined to think that we should use second 
option since it is very likely the payload could be outdated already. So the 
API should support that, again just rough idea:
   
   ```
       ...
       void register(Provider<Entity<?>> onReconnect);
       ...
   ```
   
   But it may not be sufficient though, the LAST_EVENT_ID_HEADER could come 
very handy for example. Anyway, there are few things to think about, I hope it 
makes sense, thank you.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to