swagger-socket icon indicating copy to clipboard operation
swagger-socket copied to clipboard

Request-Response Only?

Open brentarias opened this issue 9 years ago • 1 comments

I have the impression that SwaggerSocket only supports a correlated request-response model. In other words, SwaggerSocket does not support POST requests being pushed from the server. Correct? Could that feature be added?

I bring this up because I'm thinking about the webhook paradigm. A webhook is usually a POST request. If I were to convert an existing webhook enabled application to use SwaggerSocket, I'd want SwaggerSocket to support a subscription model, where POST requests are arbitrarily sent to the client.

brentarias avatar Mar 25 '16 17:03 brentarias

@brentarias sorry for the delay.

If your jaxrs resource is holding on to the output stream (over StreamingOutput or HttpServletResponse), you can push data asynchronously over that stream. There is a sample in cxf's samples that uses this approach to return a series of server events.

https://github.com/apache/cxf/blob/master/distribution/src/main/release/samples/jax_rs/websocket/src/main/java/demo/jaxrs/server/CustomerService.java

see the operations sitting at /monitor and /monitor2.

regards, aki

elakito avatar Apr 06 '16 14:04 elakito