Getting Jetty java client to work with Grizzly

View: New views
3 Messages — Rating Filter:   Alert me  

Getting Jetty java client to work with Grizzly

by Amplus :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Greetings,

 

I’m trying to port an existing Jetty Bayeux java client to work with Grizzly. I’m using the demo chat application since that has been ported from Jetty already.

 

Here is my dilemma:

 

When running against Jetty server the handshake connection goes something like this:

 

Client                        Server

Handshake                     Handshake reply successful

Connect(/meta/connect)        Connect reply successful

Connect(/meta/connect)        Jetty holds on to the Request -> long polling

Publish etc...

 

When I run the same code against Grizzly it goes like this:

Client                        Server

Handshake                     Handshake reply successful

Connect(/meta/connect)        Connect reply successful

Connect(/meta/connect)        Connect reply successful

Connect(/meta/connect)        Connect reply successful

 

Etc... until the client crashes. Grizzly doesn't seem to hold on to the long polling request.

 

I have tried modifying my code so that the java client stops connecting after the first successful connect reply, then I am able to publish messages but I'm not receiving any pushes from other clients connected to the chat since the initial connect isn't being held by the server. I find this a bit odd since the web based chat client works fine. Below is a copy of the conversations

 

-----------------------------------------------------------

 

Jetty client Jetty Server (working):

 

2008-07-23 18:58:23.864::INFO:  Request: message=[{"version": "1.0", "minimumVersion": "0.9", "channel": "/meta/handshake", "id": "0", "ext": {"json-comment-filtered": true}}]

2008-07-23 18:58:23.083::INFO:  Response: [{"id":"0","minimumVersion":"0.9","supportedConnectionTypes":["long-polling","callback-polling"],"successful":true,"channel":"/meta/handshake","advice":{"reconnect":"retry","interval":0,"timeout":120000},"clientId":"1mrrarg95sbvv8u0gg","version":"1.0"}]

 

2008-07-23 18:58:23.03::INFO:  Request: message={"channel":"/meta/connect","clientId":"1mrrarg95sbvv8u0gg","connectionType":"long-polling"}

2008-07-23 18:58:23.018::INFO:  Response: [{"successful":true,"advice":{"reconnect":"retry","interval":0,"timeout":120000},"channel":"/meta/connect"}]

 

2008-07-23 18:58:23.018::INFO:  Request: message={"channel":"/meta/connect","clientId":"1mrrarg95sbvv8u0gg","connectionType":"long-polling"} // HOLDS LONG POLLING REQUEST

 

2008-07-23 18:58:34.639::INFO:  Request: message=[{"subscription":"/chat/demo","channel":"/meta/subscribe","clientId":"1mrrarg95sbvv8u0gg"},{"id":"1216839514703","data":{"user":"GrizzlyClient","join":true,"chat":"GrizzlyClient has joined"},"channel":"/chat/demo","clientId":"1mrrarg95sbvv8u0gg"}]

 

2008-07-23 18:58:34.654::INFO:  Response: [{"successful":true,"subscription":"/chat/demo","channel":"/meta/subscribe"},{"id":"1216839514703","successful":true,"channel":"/chat/demo"},{"id":"1216839514703","data":["GrizzlyClient"],"channel":"/chat/demo"},{"data":{"chat":"GrizzlyClient has joined","join":true,"user":"GrizzlyClient"},"id":"1216839514703","channel":"/chat/demo"}]

 

2008-07-23 18:58:45.101::INFO:  Request: message=[{"id":"1216839525437","data":{"user":"GrizzlyClient","chat":"Hello"},"channel":"/chat/demo","clientId":"1mrrarg95sbvv8u0gg"}]

2008-07-23 18:58:45.116::INFO:  Response: [{"id":"1216839525437","successful":true,"channel":"/chat/demo"},{"data":{"chat":"Hello","user":"GrizzlyClient"},"id":"1216839525437","channel":"/chat/demo"}]

 

2008-07-23 18:58:53.924::INFO:  Request: message=[{"id":"1216839533468","data":{"user":"GrizzlyClient","leave":true,"chat":"Grizzly client has

2008-07-23 18:58:53.940::INFO:  Response: [{"id":"1216839533468","successful":true,"channel":"/chat/demo"},{"data":{"leave":true,"chat":"Grizzly client has left","user":"GrizzlyClient"},"id":"1216839533468","channel":"/chat/demo"}]

 

2008-07-23 18:58:53.940::INFO:  Request: message=[{"subscription":"/chat/demo","channel":"/meta/unsubscribe","clientId":"1mrrarg95sbvv8u0gg"},{"channel":"/meta/disconnect","clientId":"1mrrarg95sbvv8u0gg"}]

2008-07-23 18:58:53.940::INFO:  Response: [{"successful":true,"channel":"/meta/connect"}]

 

------------------------------------------------------------

Jetty client Grizzly server (not working)

 

2008-07-23 16:58:28.659::INFO:  Request: message=[{"version": "1.0", "minimumVersion": "0.9", "channel": "/meta/handshake", "id": "0", "ext": {"json-comment-filtered": true}}]

2008-07-23 16:58:29.971::INFO:  Response: /*[{"channel":"/meta/handshake","version":"1.0","supportedConnectionTypes":["long-polling","callback-polling"],"minimumVersion":"0.9","id":"0","clientId":"72daf174eac043c1","successful":true,"advice":{"reconnect":"retry","interval":0,"multiple-clients":false},"authSuccessful":true}]*/

 

2008-07-23 16:58:29.050::INFO:  Request: message={"channel":"/meta/connect","clientId":"72daf174eac043c1","connectionType":"long-polling"}

2008-07-23 16:58:29.050::INFO:  Response: /*[{"channel":"/meta/connect","clientId":"72daf174eac043c1","successful":true,"advice":{"reconnect":"retry","interval":0,"multiple-clients":false},"timestamp":"Wed, 23 Jul 2008 16:58:29 GMT"}]*/

 

2008-07-23 16:58:29.050::INFO:  Request: message={"channel":"/meta/connect","clientId":"72daf174eac043c1","connectionType":"long-polling"}

2008-07-23 16:58:29.096::INFO:  Response: /*[{"channel":"/meta/connect","clientId":"72daf174eac043c1","successful":true,"advice":{"reconnect":"retry","interval":0,"multiple-clients":false},"timestamp":"Wed, 23 Jul 2008 16:58:29 GMT"}]*/

 

2008-07-23 16:58:29.096::INFO:  Request: message={"channel":"/meta/connect","clientId":"72daf174eac043c1","connectionType":"long-polling"}

2008-07-23 16:58:29.096::INFO:  Response: /*[{"channel":"/meta/connect","clientId":"72daf174eac043c1","successful":true,"advice":{"reconnect":"retry","interval":0,"multiple-clients":false},"timestamp":"Wed, 23 Jul 2008 16:58:29 GMT"}]*/

 

I did file a bug

- Bjarki B


Re: Getting Jetty java client to work with Grizzly

by Shing Wai Chan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Bjarki,
Can you send us a test case?
Thanks.
     Shing Wai Chan


bb72@... wrote:

>
> Greetings,
>
>  
>
> I’m trying to port an existing Jetty Bayeux java client to work with
> Grizzly. I’m using the demo chat application since that has been
> ported from Jetty already.
>
>  
>
> Here is my dilemma:
>
>  
>
> When running against Jetty server the handshake connection goes
> something like this:
>
>  
>
> Client                        Server
>
> Handshake                     Handshake reply successful
>
> Connect(/meta/connect)        Connect reply successful
>
> Connect(/meta/connect)        Jetty holds on to the Request -> long
> polling
>
> Publish etc...
>
>  
>
> When I run the same code against Grizzly it goes like this:
>
> Client                        Server
>
> Handshake                     Handshake reply successful
>
> Connect(/meta/connect)        Connect reply successful
>
> Connect(/meta/connect)        Connect reply successful
>
> Connect(/meta/connect)        Connect reply successful
>
>  
>
> Etc... until the client crashes. Grizzly doesn't seem to hold on to
> the long polling request.
>
>  
>
> I have tried modifying my code so that the java client stops
> connecting after the first successful connect reply, then I am able to
> publish messages but I'm not receiving any pushes from other clients
> connected to the chat since the initial connect isn't being held by
> the server. I find this a bit odd since the web based chat client
> works fine. Below is a copy of the conversations
>
>  
>
> -----------------------------------------------------------
>
>  
>
> Jetty client Jetty Server (working):
>
>  
>
> 2008-07-23 18:58:23.864::INFO:  Request: message=[{"version": "1.0",
> "minimumVersion": "0.9", "channel": "/meta/handshake", "id": "0",
> "ext": {"json-comment-filtered": true}}]
>
> 2008-07-23 18:58:23.083::INFO:  Response:
> [{"id":"0","minimumVersion":"0.9","supportedConnectionTypes":["long-polling","callback-polling"],"successful":true,"channel":"/meta/handshake","advice":{"reconnect":"retry","interval":0,"timeout":120000},"clientId":"1mrrarg95sbvv8u0gg","version":"1.0"}]
>
>  
>
> 2008-07-23 18:58:23.03::INFO:  Request:
> message={"channel":"/meta/connect","clientId":"1mrrarg95sbvv8u0gg","connectionType":"long-polling"}
>
> 2008-07-23 18:58:23.018::INFO:  Response:
> [{"successful":true,"advice":{"reconnect":"retry","interval":0,"timeout":120000},"channel":"/meta/connect"}]
>
>  
>
> 2008-07-23 18:58:23.018::INFO:  Request:
> message={"channel":"/meta/connect","clientId":"1mrrarg95sbvv8u0gg","connectionType":"long-polling"}
> // HOLDS LONG POLLING REQUEST
>
>  
>
> 2008-07-23 18:58:34.639::INFO:  Request:
> message=[{"subscription":"/chat/demo","channel":"/meta/subscribe","clientId":"1mrrarg95sbvv8u0gg"},{"id":"1216839514703","data":{"user":"GrizzlyClient","join":true,"chat":"GrizzlyClient
> has joined"},"channel":"/chat/demo","clientId":"1mrrarg95sbvv8u0gg"}]
>
>  
>
> 2008-07-23 18:58:34.654::INFO:  Response:
> [{"successful":true,"subscription":"/chat/demo","channel":"/meta/subscribe"},{"id":"1216839514703","successful":true,"channel":"/chat/demo"},{"id":"1216839514703","data":["GrizzlyClient"],"channel":"/chat/demo"},{"data":{"chat":"GrizzlyClient
> has
> joined","join":true,"user":"GrizzlyClient"},"id":"1216839514703","channel":"/chat/demo"}]
>
>  
>
> 2008-07-23 18:58:45.101::INFO:  Request:
> message=[{"id":"1216839525437","data":{"user":"GrizzlyClient","chat":"Hello"},"channel":"/chat/demo","clientId":"1mrrarg95sbvv8u0gg"}]
>
> 2008-07-23 18:58:45.116::INFO:  Response:
> [{"id":"1216839525437","successful":true,"channel":"/chat/demo"},{"data":{"chat":"Hello","user":"GrizzlyClient"},"id":"1216839525437","channel":"/chat/demo"}]
>
>  
>
> 2008-07-23 18:58:53.924::INFO:  Request:
> message=[{"id":"1216839533468","data":{"user":"GrizzlyClient","leave":true,"chat":"Grizzly
> client has
>
> 2008-07-23 18:58:53.940::INFO:  Response:
> [{"id":"1216839533468","successful":true,"channel":"/chat/demo"},{"data":{"leave":true,"chat":"Grizzly
> client has
> left","user":"GrizzlyClient"},"id":"1216839533468","channel":"/chat/demo"}]
>
>  
>
> 2008-07-23 18:58:53.940::INFO:  Request:
> message=[{"subscription":"/chat/demo","channel":"/meta/unsubscribe","clientId":"1mrrarg95sbvv8u0gg"},{"channel":"/meta/disconnect","clientId":"1mrrarg95sbvv8u0gg"}]
>
> 2008-07-23 18:58:53.940::INFO:  Response:
> [{"successful":true,"channel":"/meta/connect"}]
>
>  
>
> ------------------------------------------------------------
>
> Jetty client Grizzly server (not working)
>
>  
>
> 2008-07-23 16:58:28.659::INFO:  Request: message=[{"version": "1.0",
> "minimumVersion": "0.9", "channel": "/meta/handshake", "id": "0",
> "ext": {"json-comment-filtered": true}}]
>
> 2008-07-23 16:58:29.971::INFO:  Response:
> /*[{"channel":"/meta/handshake","version":"1.0","supportedConnectionTypes":["long-polling","callback-polling"],"minimumVersion":"0.9","id":"0","clientId":"72daf174eac043c1","successful":true,"advice":{"reconnect":"retry","interval":0,"multiple-clients":false},"authSuccessful":true}]*/
>
>  
>
> 2008-07-23 16:58:29.050::INFO:  Request:
> message={"channel":"/meta/connect","clientId":"72daf174eac043c1","connectionType":"long-polling"}
>
> 2008-07-23 16:58:29.050::INFO:  Response:
> /*[{"channel":"/meta/connect","clientId":"72daf174eac043c1","successful":true,"advice":{"reconnect":"retry","interval":0,"multiple-clients":false},"timestamp":"Wed,
> 23 Jul 2008 16:58:29 GMT"}]*/
>
>  
>
> 2008-07-23 16:58:29.050::INFO:  Request:
> message={"channel":"/meta/connect","clientId":"72daf174eac043c1","connectionType":"long-polling"}
>
> 2008-07-23 16:58:29.096::INFO:  Response:
> /*[{"channel":"/meta/connect","clientId":"72daf174eac043c1","successful":true,"advice":{"reconnect":"retry","interval":0,"multiple-clients":false},"timestamp":"Wed,
> 23 Jul 2008 16:58:29 GMT"}]*/
>
>  
>
> 2008-07-23 16:58:29.096::INFO:  Request:
> message={"channel":"/meta/connect","clientId":"72daf174eac043c1","connectionType":"long-polling"}
>
> 2008-07-23 16:58:29.096::INFO:  Response:
> /*[{"channel":"/meta/connect","clientId":"72daf174eac043c1","successful":true,"advice":{"reconnect":"retry","interval":0,"multiple-clients":false},"timestamp":"Wed,
> 23 Jul 2008 16:58:29 GMT"}]*/
>
>  
>
> I did file a bug
>
> - Bjarki B
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


Re: Getting Jetty java client to work with Grizzly

by Amplus :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Hello Shing Wai Chan,

 

I have uploaded my test chat client to the issue I created #217. It is a command line client that you can run but the source is included in the jar. It is the GrizzlyChatClient class. It outputs the request and the response to the console along with some clutter. Hope that helps.

 

https://grizzly.dev.java.net/issues/show_bug.cgi?id=217

 

- Bjarki B


----- Original Message -----
From: Shing Wai Chan <Shing-Wai.Chan@...>
Date: Wednesday, July 23, 2008 9:35 pm
Subject: Re: Getting Jetty java client to work with Grizzly
To: dev@...

> Hi Bjarki,
> Can you send us a test case?
> Thanks.
>      Shing Wai Chan
>
>
> bb72@... wrote:
> >
> > Greetings,
> >
> > 
> >
> > I’m trying to port an existing Jetty Bayeux java client to
> work with
> > Grizzly. I’m using the demo chat application since that has
> been
> > ported from Jetty already.
> >
> > 
> >
> > Here is my dilemma:
> >
> > 
> >
> > When running against Jetty server the handshake connection
> goes
> > something like this:
> >
> > 
> >
> >
> Client                        Server
> >
> >
> Handshake                     Handshake reply successful
> >
> >
> Connect(/meta/connect)        Connect reply successful
> >
> >
> Connect(/meta/connect)        Jetty holds on to the Request -> long
> > polling
> >
> > Publish etc...
> >
> > 
> >
> > When I run the same code against Grizzly it goes like this:
> >
> >
> Client                        Server
> >
> >
> Handshake                     Handshake reply successful
> >
> >
> Connect(/meta/connect)        Connect reply successful
> >
> >
> Connect(/meta/connect)        Connect reply successful
> >
> >
> Connect(/meta/connect)        Connect reply successful
> >
> > 
> >
> > Etc... until the client crashes. Grizzly doesn't seem to hold
> on to
> > the long polling request.
> >
> > 
> >
> > I have tried modifying my code so that the java client stops
> > connecting after the first successful connect reply, then I am
> able to
> > publish messages but I'm not receiving any pushes from other
> clients
> > connected to the chat since the initial connect isn't being
> held by
> > the server. I find this a bit odd since the web based chat
> client
> > works fine. Below is a copy of the conversations
> >
> > 
> >
> > -----------------------------------------------------------
> >
> > 
> >
> > Jetty client Jetty Server (working):
> >
> > 
> >
> > 2008-07-23 18:58:23.864::INFO:  Request:
> message=[{"version": "1.0",
> > "minimumVersion": "0.9", "channel": "/meta/handshake", "id":
> "0",
> > "ext": {"json-comment-filtered": true}}]
> >
> > 2008-07-23 18:58:23.083::INFO:  Response:
> >
> [{"id":"0","minimumVersion":"0.9","supportedConnectionTypes":["long-polling","callback-polling"],"successful":true,"channel":"/meta/handshake","advice":{"reconnect":"retry","interval":0,"timeout":120000},"clientId":"1mrrarg95sbvv8u0gg","version":"1.0"}]
> >
> > 
> >
> > 2008-07-23 18:58:23.03::INFO:  Request:
> >
> message={"channel":"/meta/connect","clientId":"1mrrarg95sbvv8u0gg","connectionType":"long-polling"}
> >
> > 2008-07-23 18:58:23.018::INFO:  Response:
> >
> [{"successful":true,"advice":{"reconnect":"retry","interval":0,"timeout":120000},"channel":"/meta/connect"}]>
> > 
> >
> > 2008-07-23 18:58:23.018::INFO:  Request:
> >
> message={"channel":"/meta/connect","clientId":"1mrrarg95sbvv8u0gg","connectionType":"long-polling"}
> > // HOLDS LONG POLLING REQUEST
> >
> > 
> >
> > 2008-07-23 18:58:34.639::INFO:  Request:
> >
> message=[{"subscription":"/chat/demo","channel":"/meta/subscribe","clientId":"1mrrarg95sbvv8u0gg"},{"id":"1216839514703","data":{"user":"GrizzlyClient","join":true,"chat":"GrizzlyClient
> > has
> joined"},"channel":"/chat/demo","clientId":"1mrrarg95sbvv8u0gg"}]>
> > 
> >
> > 2008-07-23 18:58:34.654::INFO:  Response:
> >
> [{"successful":true,"subscription":"/chat/demo","channel":"/meta/subscribe"},{"id":"1216839514703","successful":true,"channel":"/chat/demo"},{"id":"1216839514703","data":["GrizzlyClient"],"channel":"/chat/demo"},{"data":{"chat":"GrizzlyClient
> > has
> >
> joined","join":true,"user":"GrizzlyClient"},"id":"1216839514703","channel":"/chat/demo"}]>
> > 
> >
> > 2008-07-23 18:58:45.101::INFO:  Request:
> >
> message=[{"id":"1216839525437","data":{"user":"GrizzlyClient","chat":"Hello"},"channel":"/chat/demo","clientId":"1mrrarg95sbvv8u0gg"}]>
> > 2008-07-23 18:58:45.116::INFO:  Response:
> >
> [{"id":"1216839525437","successful":true,"channel":"/chat/demo"},{"data":{"chat":"Hello","user":"GrizzlyClient"},"id":"1216839525437","channel":"/chat/demo"}]>
> > 
> >
> > 2008-07-23 18:58:53.924::INFO:  Request:
> >
> message=[{"id":"1216839533468","data":{"user":"GrizzlyClient","leave":true,"chat":"Grizzly
> > client has
> >
> > 2008-07-23 18:58:53.940::INFO:  Response:
> >
> [{"id":"1216839533468","successful":true,"channel":"/chat/demo"},{"data":{"leave":true,"chat":"Grizzly
> > client has
> >
> left","user":"GrizzlyClient"},"id":"1216839533468","channel":"/chat/demo"}]>
> > 
> >
> > 2008-07-23 18:58:53.940::INFO:  Request:
> >
> message=[{"subscription":"/chat/demo","channel":"/meta/unsubscribe","clientId":"1mrrarg95sbvv8u0gg"},{"channel":"/meta/disconnect","clientId":"1mrrarg95sbvv8u0gg"}]>
> > 2008-07-23 18:58:53.940::INFO:  Response:
> > [{"successful":true,"channel":"/meta/connect"}]
> >
> > 
> >
> > ------------------------------------------------------------
> >
> > Jetty client Grizzly server (not working)
> >
> > 
> >
> > 2008-07-23 16:58:28.659::INFO:  Request:
> message=[{"version": "1.0",
> > "minimumVersion": "0.9", "channel": "/meta/handshake", "id":
> "0",
> > "ext": {"json-comment-filtered": true}}]
> >
> > 2008-07-23 16:58:29.971::INFO:  Response:
> >
> /*[{"channel":"/meta/handshake","version":"1.0","supportedConnectionTypes":["long-polling","callback-polling"],"minimumVersion":"0.9","id":"0","clientId":"72daf174eac043c1","successful":true,"advice":{"reconnect":"retry","interval":0,"multiple-clients":false},"authSuccessful":true}]*/
> >
> > 
> >
> > 2008-07-23 16:58:29.050::INFO:  Request:
> >
> message={"channel":"/meta/connect","clientId":"72daf174eac043c1","connectionType":"long-polling"}
> >
> > 2008-07-23 16:58:29.050::INFO:  Response:
> >
> /*[{"channel":"/meta/connect","clientId":"72daf174eac043c1","successful":true,"advice":{"reconnect":"retry","interval":0,"multiple-clients":false},"timestamp":"Wed,
> > 23 Jul 2008 16:58:29 GMT"}]*/
> >
> > 
> >
> > 2008-07-23 16:58:29.050::INFO:  Request:
> >
> message={"channel":"/meta/connect","clientId":"72daf174eac043c1","connectionType":"long-polling"}
> >
> > 2008-07-23 16:58:29.096::INFO:  Response:
> >
> /*[{"channel":"/meta/connect","clientId":"72daf174eac043c1","successful":true,"advice":{"reconnect":"retry","interval":0,"multiple-clients":false},"timestamp":"Wed,
> > 23 Jul 2008 16:58:29 GMT"}]*/
> >
> > 
> >
> > 2008-07-23 16:58:29.096::INFO:  Request:
> >
> message={"channel":"/meta/connect","clientId":"72daf174eac043c1","connectionType":"long-polling"}
> >
> > 2008-07-23 16:58:29.096::INFO:  Response:
> >
> /*[{"channel":"/meta/connect","clientId":"72daf174eac043c1","successful":true,"advice":{"reconnect":"retry","interval":0,"multiple-clients":false},"timestamp":"Wed,
> > 23 Jul 2008 16:58:29 GMT"}]*/
> >
> > 
> >
> > I did file a bug
> >
> > - Bjarki B
> >
>
>
> -----------------------------------------------------------------
> ----
> To unsubscribe, e-mail: dev-unsubscribe@...
> For additional commands, e-mail: dev-help@...
>
>
LightInTheBox - Buy quality products at wholesale price