You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jackose <jr...@gmail.com> on 2009/06/04 09:21:21 UTC

server to client notification

Hi All,
       I want to know whether there is any way to invoke a page or send
notification from server to client. I am using tomcat 5. If possible, could
you please explain me how to do it with a sample example.

Awaiting for your response.

Thanks,
Jackson
-- 
View this message in context: http://www.nabble.com/server-to-client-notification-tp23865023p23865023.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: server to client notification

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jackose,

On 6/4/2009 9:07 AM, Jackose wrote:
> Say for example, I have four clients and a server. If client1 sends the
> message "hi", the server receives the message "hi" and the server must send
> this "hi" message to clients1,2,3 & 4.

This isn't really how HTTP works. The clients always initiate the
requests, and the server fulfills them. Any web-based services that
appear to work otherwise are doing one of the following:

1. Clients are polling the server for messages (resource-intensive).
  (Think gmail)
or
2. Clients are themselves acting as servers, and the "server" is
   acting as a client.
   (Think web services)

There are some semi-standard ways to send messages like this using
publish/subscribe capabilities. Two such strategies that come to mind
are MQ (aka Java Message Service which is pub/sub using #2 above) and
RSS (which is polling a la #1 above).

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkooPBEACgkQ9CaO5/Lv0PBwWgCgu6JVxMqUfxQt7QpCM1LGfPIX
0isAn0hzsDXoPdEfjDOwu3nxHPOky3Vy
=+Iuw
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: server to client notification

Posted by Jackose <jr...@gmail.com>.
Hello Josh & Ronald, 
       
Thank you fro your response. 

Say for example, I have four clients and a server. If client1 sends the
message "hi", the server receives the message "hi" and the server must send
this "hi" message to clients1,2,3 & 4.

And there may be a scenario to send some messages to all clients without a
client request to the server. Is this can be achieved. If so can you please
explain me with an example.


Jackson


Ronald Klop wrote:
> 
> client <---> tomcatServer <---> notificationServer
> 
> 1. client sends request to tomcatServer
> 2. tomcatServer calls notificationServer.waitForEvent() (this can wait
> forever if there is no event)
> 3. tomcatServer get event and send response to the client.
> 
> Warning: step 2 takes up 1 thread. You can optimize that with Comet in
> Tomcat 6. But maybe the simple implementation is enough for your
> situation.
> 
> Ronald.
> 
> 
> Op donderdag, 4 juni 2009 13:11 schreef Josh Gooding  :> 
>> Hello Jackson,
>> 
>> Can you give us an example on a situation you are looking to have
>> notification for please.  It might help better answer your question.
>> 
>> Warm regards,
>> 
>> - Josh
>> 
>> On Thu, Jun 4, 2009 at 3:21 AM, Jackose <jr...@gmail.com> wrote:
>> 
>> >
>> > Hi All,
>> >       I want to know whether there is any way to invoke a page or send
>> > notification from server to client. I am using tomcat 5. If possible,
>> could
>> > you please explain me how to do it with a sample example.
>> >
>> > Awaiting for your response.
>> >
>> > Thanks,
>> > Jackson
>> > --
>> > View this message in context:
>> >
>> http://www.nabble.com/server-to-client-notification-tp23865023p23865023.html
>> > Sent from the Tomcat - User mailing list archive at Nabble.com.
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> > For additional commands, e-mail: users-help@tomcat.apache.org
>> >
>> >
>>  
>> 
>> 
>> 
> 
>   
> 

-- 
View this message in context: http://www.nabble.com/server-to-client-notification-tp23865023p23869577.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: server to client notification

Posted by Ronald Klop <ro...@base.nl>.
client <---> tomcatServer <---> notificationServer

1. client sends request to tomcatServer
2. tomcatServer calls notificationServer.waitForEvent() (this can wait forever if there is no event)
3. tomcatServer get event and send response to the client.

Warning: step 2 takes up 1 thread. You can optimize that with Comet in Tomcat 6. But maybe the simple implementation is enough for your situation.

Ronald.


Op donderdag, 4 juni 2009 13:11 schreef Josh Gooding  :> 
> Hello Jackson,
> 
> Can you give us an example on a situation you are looking to have
> notification for please.  It might help better answer your question.
> 
> Warm regards,
> 
> - Josh
> 
> On Thu, Jun 4, 2009 at 3:21 AM, Jackose <jr...@gmail.com> wrote:
> 
> >
> > Hi All,
> >       I want to know whether there is any way to invoke a page or send
> > notification from server to client. I am using tomcat 5. If possible, could
> > you please explain me how to do it with a sample example.
> >
> > Awaiting for your response.
> >
> > Thanks,
> > Jackson
> > --
> > View this message in context:
> > http://www.nabble.com/server-to-client-notification-tp23865023p23865023.html
> > Sent from the Tomcat - User mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
>  
> 
> 
> 

  

Re: server to client notification

Posted by Josh Gooding <jo...@gmail.com>.
Hello Jackson,

Can you give us an example on a situation you are looking to have
notification for please.  It might help better answer your question.

Warm regards,

- Josh

On Thu, Jun 4, 2009 at 3:21 AM, Jackose <jr...@gmail.com> wrote:

>
> Hi All,
>       I want to know whether there is any way to invoke a page or send
> notification from server to client. I am using tomcat 5. If possible, could
> you please explain me how to do it with a sample example.
>
> Awaiting for your response.
>
> Thanks,
> Jackson
> --
> View this message in context:
> http://www.nabble.com/server-to-client-notification-tp23865023p23865023.html
> Sent from the Tomcat - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>