Hi Christian,
sorry for the delay...was at ApacheConf :-)
Christian Winkler wrote:
> Hello Mr. Arcand,
>
> this is keineahnung from your grizzly blog.
>
> My real name is Christian and i study computer scince on the university
> in Fulda (Hessen, Germany).
> University of Appilied Sciences Link:
> http://www.fh-fulda.de/index.php?id=682&L=1
> More to my person: https://www.xing.com/profile/Christian_Winkler36
OK quite interesting
>
> I am writing my diploma thesis about Grizzly and RIO and i have some
> problems to provide a dynamic push service to
> the webbrowser using AJAX over grizzly.
> System overview:
> The webclient subcribes a particular channel and a specific RIO service
> will be discovered. The RIO service reads over
> a socket dynamic informations (for example from a maschine to manage or
> observe it) from a database. Now the RIO Service
> should push the received informations to all client which subscribe
> these channel.
Where is the RIO client located (is he running inside or outside GlassFish)?
>
> On my view there are two possibilities to solve it:
> 1. Implemement a BayeuxJavaClient for each RIO Service to push incoming
> data. (I wont do this because RIO should be thin as possible)
> 2. RIO should use methods from grizzly perhaps onData or onSubscribe.
> But it doesn't work very well.
OK your RIO client seems to be inside GlassFish. To push data to the
clients, you might want to use a CometHandler and register it like that:
CometContext ctx =
CometEngine.getEngine().getCometContext("/cometd/cometd");
ctx.addCometHandler(RIOCometHandler)
Now using the RIOCometHandler, every time you need to push data you can do:
ctx.notify( JSON messages );
this way all Bayeux clients will be updated. Does it makes sense?
Thanks
-- jeanfrancois
> So, how can i use Grizzly methods to push data from an RIO service ? How
> can i create a onData-Event ?
> I cant use a onSubscribe event to send data over onData method. I
> believe thats my main problem.
>
> Hope you could help me.
>
> Greetings
> C. Winkler
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>