gimite / web-socket-js

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

Hooks and event sending #76

Closed cgbystrom closed 13 years ago

cgbystrom commented 13 years ago

Added a way to force the use of Flash over native WS (useful when debugging)

A simple event mechanism has also been added to aid developers using the web-socket-js library. It allows to respond to certain events, such as SWF embed failure. Previously it just logged these with the console object (as you may know). I thought this was a better way of hooking in to what web-socket-js is up to. Enables developers to show better error messages for their end users.

There's also possible to override the logging.

gimite commented 13 years ago

Sorry for late. Thanks for the patch.

I pulled only the first commit for now. To check if Flash player is missing or too old, you can write: if (window.WebSocket) ... after loading web_socket.js.

I believe other errors are due to wrong configuration/code, which should be fixed by developer (who can see console.error). So I think you don't need to show such errors to end users.

Please let me know if you have a specific use case where such error handling is required.