Simplest possible working cometd java client -
i've been trying simple cometd java server , client setup, using cometd version 3.1.2 , jetty 9.4.6.v20170531, using code cometd's documentation.
httpclient httpclient = new httpclient(); httpclient.start(); map<string, object> options = new hashmap<string, object>(); clienttransport transport = new longpollingtransport(options, httpclient); bayeuxclient client = new bayeuxclient("http://localhost:9025/mycontext/cometd/", transport); client.handshake(); boolean handshaken = client.waitfor(5000, bayeuxclient.state.connected); if (handshaken) { system.out.println("yes"); // here handshake successful } system.out.println("done"); the server setup i'm interested in, , spring injected embedded jetty server cometd servlet. no matter i've tried client not handshake. able prove server correctly setup , available send request via postman...
post http://localhost:9025/mycontext/cometd
[{ "version": "1.0", "minimumversion": "0.9", "channel": "/meta/handshake", "supportedconnectiontypes": [ "long-polling", "callback-polling" ], "advice": { "timeout": 60000, "interval": 0 }, "id": "1" }] ...which returns 200...
[ { "minimumversion": "1.0", "clientid": "11jlmrekgqnu9v1i4w1b8rgiq3c", "supportedconnectiontypes": [ "long-polling", "websocket" ], "advice": { "interval": 0, "timeout": 60000, "reconnect": "retry" }, "channel": "/meta/handshake", "id": "1", "version": "1.0", "successful": true } ] ...so, clearly, server setup fine. i've set break points , used tcpflow traffic , can tell, simplest possible client using cometd's own libraries starter documentation never sends request @ all. no tcp traffic. know i'm missing? appreciated.
you must have else going on.
your code correct, , cometd test suite uses code hundreds of tests , it's working fine.
please have read @ troubleshooting section of cometd documentation.
as suggestion, enable debug logging level org.cometd category, , @ logs obtain: should evident problem is.
feel free attach logs issue @ cometd issue tracker if still have problems.
Comments
Post a Comment