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

Joakim Erdfelt <[email protected]> Thu, 7 Mar 2013 09:46:35 -0700
Newsgroups gmane.comp.java.jetty.general
Message-ID <CAG4zZZDtW_456z5jmSGiQ1RLMPDmZFB8=tXR=a6pGFyREg0obA@mail.gmail.com>
--047d7b343b1c1e3d8a04d75873c6
Content-Type: text/plain; charset=ISO-8859-1

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 <[email protected]>
webtide.com <http://www.webtide.com/>
Developer advice, services and support
from the Jetty & CometD experts
eclipse.org/jetty - cometd.org


On Wed, Mar 6, 2013 at 10:01 PM, Scott Morgan <[email protected]> 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;
>
> http://cvs.adligo.org/viewvc/aws_client/src/org/adligo/aws_client/WebSocketClient.java?view=markup
>
> 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
>
>

--047d7b343b1c1e3d8a04d75873c6
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Which version of Jetty are you attempting to connect to?<div><br></div><div=
>The error message you got is the server saying that you didn&#39;t provide=
 a Sec-WebSocket-Version request header that it recognized.</div><div>Note:=
 this error message text has been cleaned up for the next release of Jetty =
7 and Jetty 8.</div>
<div><br></div><div>It could be that either you are not sending this reques=
t header, or that the server is configured to not support the version you a=
re specifying.</div><div>In recent versions of Jetty 7 and Jetty 8, there i=
s a &quot;minVersion&quot; init-param on the servlet that can control this =
minimum supported websocket version. =A0(if you have access to the server, =
set that to &quot;-1&quot; to enable all versions of websocket, even draft =
versions)</div>
<div><div><br clear=3D"all"><div><div>--</div><div>Joakim Erdfelt &lt;<a hr=
ef=3D"mailto:[email protected]" target=3D"_blank">[email protected]</a>&g=
t;</div><div><a href=3D"http://www.webtide.com/" target=3D"_blank">webtide.=
com</a></div>
<div><span>Developer advice, services and support</span><br><span>from the =
Jetty &amp; CometD experts</span></div><div><a href=3D"http://eclipse.org/j=
etty/" target=3D"_blank">eclipse.org/jetty</a>=A0-=A0<a href=3D"http://come=
td.org/" target=3D"_blank">cometd.org</a></div>
</div>
<br><br><div class=3D"gmail_quote">On Wed, Mar 6, 2013 at 10:01 PM, Scott M=
organ <span dir=3D"ltr">&lt;<a href=3D"mailto:[email protected]" target=3D"_=
blank">[email protected]</a>&gt;</span> wrote:<br><blockquote class=3D"gmail=
_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:=
1ex">
<div dir=3D"ltr">Hi,<div><br></div><div>=A0 =A0Sorry for the cross post, I =
don&#39;t know where this should go. =A0I would like to use the jetty web s=
ocket-client in stand alone java applications (outside of a jetty web app i=
e main(String[] args)).</div>

<div>=A0 =A0Does the jetty web socket client support this?</div><div>=A0 =
=A0</div><div>If not I would suggest it as I am maintaining (somewhat poorl=
y) a WebSocketClient here;</div><div><a href=3D"http://cvs.adligo.org/viewv=
c/aws_client/src/org/adligo/aws_client/WebSocketClient.java?view=3Dmarkup" =
target=3D"_blank">http://cvs.adligo.org/viewvc/aws_client/src/org/adligo/aw=
s_client/WebSocketClient.java?view=3Dmarkup</a><br>

</div><div><br></div><div>I am getting</div><div><p style=3D"margin:0px;fon=
t-size:11px;font-family:Monaco;color:rgb(255,38,0)"><span style=3D"text-dec=
oration:underline;color:rgb(1,25,147)">java.io.IOException</span>: Invalid =
handshake response &#39;HTTP/1.1 400 Unsupported websocket version specific=
ation: <a href=3D"tel:2147483647" value=3D"+12147483647" target=3D"_blank">=
2147483647</a>&#39; should be &#39;HTTP/1.1 101 Web Socket Protocol Handsha=
ke&#39;</p>

<p style=3D"margin:0px;font-size:11px;font-family:Monaco;color:rgb(255,38,0=
)"><br></p><p style=3D"margin:0px;font-size:11px;font-family:Monaco;color:r=
gb(255,38,0)">TIA,</p><p style=3D"margin:0px;font-size:11px;font-family:Mon=
aco;color:rgb(255,38,0)">

Scott</p><div><br></div></div></div>
</blockquote></div><br></div></div>

--047d7b343b1c1e3d8a04d75873c6--