chandramanic / unitt

Automatically exported from code.google.com/p/unitt
0 stars 0 forks source link

wstest websockets close immediately with Google Chrome #23

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I made a web page for wstest and the Google Chrome browser. The WebSocket 
closes immediately after opening.

I put together an Eclipse/Maven project for testws, attached. I can see the 
servlet getting initialized, but it is never called again. I tried putting 
breakpoints on doPost() and service() but they are never called either.

I can see the JS on on the web page building a WebService object, but it seems 
to be rejected immediately. I looked at the chrome://net-internals/#events to 
see what response Chrome actually received, and the SOCKET_STREAM looks like 
this:

ws://localhost:8080/

Start Time: Sun Oct 02 2011 16:59:54 GMT-0700 (Pacific Daylight Time)

t=1317599994550 [st=0] +REQUEST_ALIVE             [dt=4]
t=1317599994550 [st=0]    +SOCKET_STREAM_CONNECT  [dt=1]
                           --> url = "ws://localhost:8080/"
t=1317599994550 [st=0]       +PROXY_SERVICE       [dt=0]
t=1317599994550 [st=0]           PROXY_SERVICE_RESOLVED_PROXY_LIST  
                                 --> pac_string = "DIRECT"
t=1317599994550 [st=0]       -PROXY_SERVICE       
t=1317599994550 [st=0]       +PROXY_SERVICE       [dt=0]
t=1317599994550 [st=0]           PROXY_SERVICE_RESOLVED_PROXY_LIST  
                                 --> pac_string = "DIRECT"
t=1317599994550 [st=0]       -PROXY_SERVICE       
t=1317599994550 [st=0]        HOST_RESOLVER_IMPL  [dt=0]
                              --> source_dependency = {"id":73847,"type":7}
t=1317599994551 [st=1]    -SOCKET_STREAM_CONNECT  
t=1317599994552 [st=2]     WEB_SOCKET_SEND_REQUEST_HEADERS  
                           --> GET / HTTP/1.1   
                               Upgrade: websocket
                               Connection: Upgrade
                               Host: localhost:8080
                               Sec-WebSocket-Origin: http://localhost:8080
                               Sec-WebSocket-Key: JFu57s6Wn6Ha4nPsRqVm9g==
                               Sec-WebSocket-Version: 8

t=1317599994552 [st=2]     SOCKET_STREAM_SENT     
t=1317599994554 [st=4]     SOCKET_STREAM_RECEIVED  
t=1317599994554 [st=4]     WEB_SOCKET_READ_RESPONSE_HEADERS  
                           --> HTTP/1.1 404 Not Found
                               Content-Type: text/html
                               Content-Length: 848
                               Server: Jetty(8.0.0.M3)

t=1317599994554 [st=4] -REQUEST_ALIVE       

WEB_SOCKET_READ_RESPONSE_HEADERS is not happy.

Original issue reported on code.google.com by mslinn on 3 Oct 2011 at 12:09

Attachments:

GoogleCodeExporter commented 9 years ago
Two things:
1) This is simply test code used to exercise the native web socket clients. 
Feel free to use it in whatever way you wish, but if you wish to build a server 
it is simply using Jetty to provide the server side web socket implementation. 
Regardless, it should work. See #2 for info on how to do this.
2) Your code is not pointing at the right path. You want your web socket URL to 
be ws://localhost:8080/testws/ws/test

Original comment by joshuadmorris@gmail.com on 3 Oct 2011 at 1:55