Websockets Example

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Websockets Example

uris77
Are there any examples using websockets? I want one where it shows how to publish messages from the server side. The client side is not a problem, we got that figured out. We are evaluating Ratpack for a project, and have to show a demo with websockets by EOD. Can anyone nudge me in the right direction?
rus
Reply | Threaded
Open this post in threaded view
|

Re: Websockets Example

rus
Reply | Threaded
Open this post in threaded view
|

Re: Websockets Example

uris77
I saw the codahale MetricsWebsocketBroadcastHandler but there is too much context I'm missing that will be difficult to understand in a short period of time. Will try to grok the unit test.
rus
Reply | Threaded
Open this post in threaded view
|

Re: Websockets Example

rus
There's also this https://github.com/danveloper/ratpack-foaas/blob/master/src/ratpack/Ratpack.groovy#L35

Even though the Ratpack version isn't current the broadcast concept still applies.  Since then we've added broadcast support using reactive streams instead.
Reply | Threaded
Open this post in threaded view
|

Re: Websockets Example

uris77
Thanks will give it a try. Currently evaluating http-kit (clojure). We just ruled out meteorjs. We really want Ratpack to work out, but we need to build a working demo first :).
rus
Reply | Threaded
Open this post in threaded view
|

Re: Websockets Example

rus
I'm gonna be calling it a night soon but if you post your code will help you get it working first thing.  If you haven't already got it working.

Using the streams to broadcast is quite easy once you've grokked it
Reply | Threaded
Open this post in threaded view
|

Re: Websockets Example

uris77
It's almost 5 here, so will finish up the http-kit evaluation and work on Ratpack early tomorrow morning (4am my time). I tend to work better early in the morning when I'm not too tired.
rus
Reply | Threaded
Open this post in threaded view
|

Re: Websockets Example

rus
How did you get on in the end?
Reply | Threaded
Open this post in threaded view
|

Re: Websockets Example

uris77
We decided not to use it. Was a hard sell for websockets. Although we got a demo working, all the conversations in github issues about websockets + ratpack did sound too convincing. It made the clients nervous. The three candidates are Spring Boot, http-kit and meteor. They asked us to look into meteor, and the rest of their apps are built with Spring Boot. Hopefully we get to nudge them towards clojure/http-kit. That is my favorite so far.
rus
Reply | Threaded
Open this post in threaded view
|

Re: Websockets Example

rus
As long as you managed to get your demo working.

Any suggestions to improve the support are welcome :)
Reply | Threaded
Open this post in threaded view
|

Re: Websockets Example

danhyun
Sorry I'm so late to this but Dan Woods has a talk with demo code using websockets https://github.com/danveloper/gr8confus-2014-real-time-ratpack/blob/master/src/main/groovy/gr8conf/EventBroadcaster.groovy