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

onclose is not emitted if an error occurs on send #151

Closed x25 closed 10 years ago

x25 commented 10 years ago
WEB_SOCKET_DEBUG = true;
WEB_SOCKET_FORCE_FLASH = true;
...
var s = new WebSocket(url);

s.onerror = function (error) {
  console.log('WebSocket.onerror');
};

s.onclose = function () {
  //This will not be called if an error occurs
  console.log('WebSocket.onclose');
};

After short period of inactivity ~1min and right after s.send(...):

[WebSocket] Error while sending frame: Error #2002: Operation attempted on invalid socket.
logger.error(decodeURIComponent(message));
[WebSocket] closed
WebSocket.onerror
gimite commented 10 years ago

Sorry for late. Thanks for the report. Pulled your fix.