dev@grizzly.java.net

Getting Jetty java client to work with Grizzly

From: <bb72_at_kent.ac.uk>
Date: Wed, 23 Jul 2008 20:18:50 +0100

<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {mso-style-parent:"";
        margin:0cm;
        margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:12.0pt;
        font-family:"Times New Roman";
        mso-fareast-font-family:"Times New Roman";
        mso-ansi-language:EN-GB;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
        {margin:0cm;
        margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:10.0pt;
        font-family:"Courier New";
        mso-fareast-font-family:"Times New Roman";
        mso-ansi-language:EN-GB;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 77.95pt 72.0pt 77.95pt;
        mso-header-margin:35.4pt;
        mso-footer-margin:35.4pt;
        mso-paper-source:0;}
div.Section1
        {page:Section1;}
-->


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