gimite / web-socket-js

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

FIXED !Important Please read and update your code #145

Closed benzmuircroft closed 10 years ago

benzmuircroft commented 10 years ago

My console log shows me this TypeError with no line number for the error

[WebSocket] response header: HTTP/1.1 101 Switching Protocols Upgrade: websocket Connection: Upgrade Sec-WebSocket-Accept: EKe7xY9gtGUsL6JCb3hs1x2qLU8=

TypeError {} (anonymous function)

happens every time the same after/during upgrade response... server side the last thing that happens is ws.on('connection',function(){ console.log('connected');//------------------------------------<< I see this happens! then error on the client side });

Where might this error come from? I think one of the .as files.... I am not familiar with how to compile and build an swf with all these files, I have Flash Professional CS5.5, I would like to try adding some more console log messages to the code so I can see exactly what is the last thing that happens before the error.

benzmuircroft commented 10 years ago

I've completely commented out virtually every line of the einaros ws/lib/WebSockets.js file on my server so I think it cant be that my server is sending to the browser any data for the upgrade because I still see in my browser console log the same upgrade request and response then the typeError.

I think that the browser is sending this stuff and then throwing a fit of anger because it hasn't got an immediate response the same second...

is this correct?

benzmuircroft commented 10 years ago

__onFlashEvent

when it tries the open event something goes wrong!

line 350 of web_socket.js is where The typeError comes from...

logger.error(e);

Please change this to:

logger.error(e+' web_socket.js:350');

What is wrong this with flash event?

{protocol: null
readyState: 1
type: "open"
webSocketId: 0
__proto__: Object}

is the protocol suppose to be null? where is this coming from if I've commented out most of my server ws code????

benzmuircroft commented 10 years ago

didn't mean to close

benzmuircroft commented 10 years ago

this line causes error:

 WebSocket.__instances[events[i].WebSocketId].__handleEvent(events[i]);
benzmuircroft commented 10 years ago

It throws an error because events[i].WebSocketId is not suppose to have a capital W

gimite commented 10 years ago

Did it work fine if you modify WebSocketId to webSocketId? It is webSocketId in the repository, so I believe you accidentally modified it.

benzmuircroft commented 10 years ago

no I saw it here in fact

gimite commented 10 years ago

It is recorded that it was webSocketId at least after 2011-03-05, per https://github.com/gimite/web-socket-js/blame/master/web_socket.js .