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

"Recursive call into Flash Player" error in Firefox #34

Closed steadicat closed 13 years ago

steadicat commented 14 years ago

We've been getting reports of users seeing this error in Firefox:

"Error: You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround."

gimite commented 14 years ago

What's your code using WebSocket look like? It may happen when you call method of WebSocket inside WebSocket callback such as ws.onmessage. In that case, as the error message suggests, calling such method using setTimeout such as setTimeout(function() { ws.send(...); }, 1); may work as workaround. It would be better if it works without such workaround, though...

thaihung203 commented 13 years ago

We got the same error message in firefox when do the load test. In this case, when server send 1 message/10ms, firefox hang with this message. When server send 1ms/second everything seems fine. Note : Chrome works perfectly with all case :(

The server code (build on jetty) : while (true) { DirectControler.broadcast(dummy_message); try { Thread.currentThread().sleep(10); } catch (InterruptedException e) { System.out.print(e); } } The client code (this.socket is an instant of your flash web socket): this.socket.onmessage = function(message) { console.log("new message " + message.data);

    };
gimite commented 13 years ago

This may be fixed by this change: https://github.com/gimite/web-socket-js/commit/20f837425d44144f0df7020a5f98350be2b83745

gimite commented 13 years ago

Assuming this is fixed. Please reopen if it's still reproduced.