gimite / web-socket-js

HTML5 Web Socket implementation powered by Flash
BSD 3-Clause "New" or "Revised" License
2.73k stars 488 forks source link

Compatibility with Tomcat7 Websocket implementation #121

Closed Jannis87 closed 12 years ago

Jannis87 commented 12 years ago

I implemented my WebSocket Server with Tomcat. Everything in Chrome and Firefox works fine but the Flash-Fallback doesnt work. After a short look to the debug log i found a few differences between the request headers sent by Firefox and the Flashobject.

FlashObject:

PROTOKOLL: [WebSocket] request header: GET xxxx HTTP/1.1 Upgrade: WebSocket Connection: Upgrade Host: localhost:8080 Origin: http://localhost:8080 Cookie: Sec-WebSocket-Key1: 1 1 8 2 ; 7837 01 Sec-WebSocket-Key2: 95N94GB6 8 K 692

The Answer of my Tomcat Websocket is:

PROTOKOLL: [WebSocket] response header:
HTTP/1.1 400 Bad Request
Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=8BA687375DF486D3D48D251009776376; Path=/Stores/; HttpOnly
Content-Type: text/html;charset=utf-8
Content-Length: 971
Date: Mon, 13 Aug 2012 07:36:59 GMT
Connection: close

Firefox:

GET xxxx HTTP/1.1 Host: localhost:8080 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20100101 Firefox/15.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: de-de,en-us;q=0.7,en;q=0.3 Accept-Encoding: gzip, deflate Connection: keep-alive, Upgrade Sec-WebSocket-Version: 13 Origin: http://localhost:8080 Sec-WebSocket-Key: eNGwTswQtOw/7mDumP/XlQ== Cookie: JSESSIONID=35361218C9B8321A86797D85BD42B4BE; tvgid=%23afternoon; chgroup=FavsFavs; lastpage=timeline.html%3Faktion%3Dtimeline; tlchgrp=FavsDVB-T; tlzoomx=360; tltfont=14; tlctips=true; tlcdate=08.08.2012; tlctime=5530; tlnow=false; tlvpos=0 Pragma: no-cache Cache-Control: no-cache Upgrade: websocket

I think both should use the RFC 6455 spec. Why are the requests so different? Maybe it isnt a bug but it would be nice to see the Flash-Fallback working with the Tomcat-Version of websockets..

gimite commented 12 years ago

I guess you use old version of web-socket-js, which speaks draft version of WebSocket protocol. Please try the latest version. When you update the library, please make sure cache of old WebSocketMain.swf is not used. Most confident way is to rename WebSocketMain.swf and update WEB_SOCKET_SWF_LOCATION.

Jannis87 commented 12 years ago

i am really sorry. Internet Explorer is caching Flash Files really strong... Only a full wipe of the cache has solved my problem. I thought restarting IE should by enough but it isnt. Thanks for your fast answer!

p.s. i love your library. It makes my websocket solutions much easier !