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

init/close fix. #88

Closed kanaka closed 13 years ago

kanaka commented 13 years ago

This is change is prep the binary API support:

Change the init and close code so that the async __flash.create() task is cancelled in close() so that you can do something like this which tests whether the newer binary API exists:

var wstest = new WebSocket('ws://localhost:57111');
if (typeof(wstest.binaryType) !== "undefined") {
    ...
}
wstest.close();
wstest = null;

Without the change, a Flash error occurs later when the connect fails (because the close() call doesn't cancel the connect).

gimite commented 13 years ago

Thanks. Pulled.