gimite/web-socket-js — pull request #107 by luciferous (2011-12-07 03:13:52+00:00)
Title: Init immediately if document.body is available

This addresses the issue where document.body is ready before the script
is loaded, which means the window "load" event does not fire, and
WebSocket never initializes.

This is because web_socket.js relies on the window "load" event for
calling WebSocket.__initialize, which embeds the Flash object into
document.body. If the document.body is already available, the "load"
event does not fire.

This patch introduces checking if document.body is available and if so,
immediately calls WebSocket.initialize instead of registering it as a
callback.

Possibly related to #101, #62, #93 as IE9 seems especially sensitive to
this issue.