Java WebSocket Client from main(String [] args)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Java WebSocket Client from main(String [] args)

Scott Morgan-3
Hi,

   Sorry for the cross post, I don't know where this should go.  I would like to use the jetty web socket-client in stand alone java applications (outside of a jetty web app ie main(String[] args)).
   Does the jetty web socket client support this?
   
If not I would suggest it as I am maintaining (somewhat poorly) a WebSocketClient here;

I am getting

java.io.IOException: Invalid handshake response 'HTTP/1.1 400 Unsupported websocket version specification: 2147483647' should be 'HTTP/1.1 101 Web Socket Protocol Handshake'


TIA,

Scott


Reply | Threaded
Open this post in threaded view
|

Re: [jetty-dev] Java WebSocket Client from main(String [] args)

Joakim Erdfelt-9
Which version of Jetty are you attempting to connect to?

The error message you got is the server saying that you didn't provide a Sec-WebSocket-Version request header that it recognized.
Note: this error message text has been cleaned up for the next release of Jetty 7 and Jetty 8.

It could be that either you are not sending this request header, or that the server is configured to not support the version you are specifying.
In recent versions of Jetty 7 and Jetty 8, there is a "minVersion" init-param on the servlet that can control this minimum supported websocket version.  (if you have access to the server, set that to "-1" to enable all versions of websocket, even draft versions)

--
Joakim Erdfelt <[hidden email]>
Developer advice, services and support
from the Jetty & CometD experts


On Wed, Mar 6, 2013 at 10:01 PM, Scott Morgan <[hidden email]> wrote:
Hi,

   Sorry for the cross post, I don't know where this should go.  I would like to use the jetty web socket-client in stand alone java applications (outside of a jetty web app ie main(String[] args)).
   Does the jetty web socket client support this?
   
If not I would suggest it as I am maintaining (somewhat poorly) a WebSocketClient here;

I am getting

java.io.IOException: Invalid handshake response 'HTTP/1.1 400 Unsupported websocket version specification: <a href="tel:2147483647" value="+12147483647" target="_blank">2147483647' should be 'HTTP/1.1 101 Web Socket Protocol Handshake'


TIA,

Scott