chiquitinxx / grooscript-plugins

Grooscript plugins - Gradle and Grails 3
12 stars 1 forks source link

Integreate spring's reactor #8

Open chrisime opened 8 years ago

chrisime commented 8 years ago

As for grails 3.x spring reactor (see http://projectreactor.io/) is quite tightly integrated. Along with atmosphere (http://async-io.org/) grooscript could abstract websockets and improve the way how server code communicates with client code and vice versa.

chiquitinxx commented 8 years ago

I think the best fit is using spring websockets. There is no implementation included in the grooscript grails plugin, maybe we can add the grails websocket plugin as dependency.

In the grails side, using reactor, maybe we can send all the events to the client using websockets. I don't know if there is a spring / reactor plan to do this stuff in near future.

In the client side, maybe we can offer a trait as in the server side (https://grails.github.io/grails-doc/latest/guide/async.html#events). So then you can create classes with that trait to comunicate with reactor. Then finally, you can create groovy classes with Events(http://grails.github.io/grails-doc/3.0.x/api/grails/events/Events.html) trait, and use reactor stuff in the client connecting to the server using websockets.

But, is interesting listen and notify reactor events in the client side?

chrisime commented 8 years ago

Hi!

Am 11.05.2016 01:27 schrieb "Jorge Franco" notifications@github.com:

I think the best fit is using spring websockets. There is no implementation included in the grooscript grails plugin, maybe we can add the grails websocket plugin as dependency.

I will have a look at this plugin. As for now it sounds fine!

In the grails side, using reactor, maybe we can send all the events to the client using websockets. I don't know if there is a spring / reactor plan to do this stuff in near future.

That would be quite easy. It would be great to provide the possibilty to define several topics on which you can listen on the client side and not to just listen on one topic.

In the client side, maybe we can offer a trait as in the server side ( https://grails.github.io/grails-doc/latest/guide/async.html#events). So then you can create classes with that trait to comunicate with reactor. Then finally, you can create groovy classes with Events( http://grails.github.io/grails-doc/3.0.x/api/grails/events/Events.html) trait, and use reactor stuff in the client connecting to the server using websockets.

I actually dont know how this is done on the client side but I'm eager to hearing from you :-)

But, is interesting listen and notify reactor events in the client side?

Yep it is, if you change something and want to notify the Server on the changes. It all boils down to decoupling the client and the server.

chiquitinxx commented 8 years ago

Already, you can do all that things. But you have to add the grails websockets plugin, redirect the events from / to the client side, and maybe add a bit of stuff in the client side.

Actually, the plugin don't force you to use any websockets implementation, only is friend of spring websokets using sockjs and stomp. So, do you think is a good idea include websocket plugin and make grails events work in the client side? Also, can create a guide to do it yourself and maybe create some Events implementation in the client side.