Commit 35f5b11c authored by Joel Martin's avatar Joel Martin

Update gimite/web-socket-js to dd80a1807758abfab4a0fde840f94c5d649e4a24

parent 48ffd4bc
// Copyright: Hiroshi Ichikawa <http://gimite.net/en/>
// Lincense: New BSD Lincense
// License: New BSD License
// Reference: http://dev.w3.org/html5/websockets/
// Reference: http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-31
......@@ -73,6 +73,10 @@ public class WebSocketMain extends Sprite {
ExternalInterface.call("webSocketLog", encodeURIComponent("[WebSocket] " + message));
}
public function error(message:String):void {
ExternalInterface.call("webSocketError", encodeURIComponent("[WebSocket] " + message));
}
public function fatal(message:String):void {
ExternalInterface.call("webSocketError", encodeURIComponent("[WebSocket] " + message));
throw message;
......
// Copyright: Hiroshi Ichikawa <http://gimite.net/en/>
// Lincense: New BSD Lincense
// License: New BSD License
// Reference: http://dev.w3.org/html5/websockets/
// Reference: http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-31
......
// Copyright: Hiroshi Ichikawa <http://gimite.net/en/>
// Lincense: New BSD Lincense
// License: New BSD License
// Reference: http://dev.w3.org/html5/websockets/
// Reference: http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-31
......
This diff is collapsed.
// Copyright: Hiroshi Ichikawa <http://gimite.net/en/>
// Lincense: New BSD Lincense
// License: New BSD License
// Reference: http://dev.w3.org/html5/websockets/
// Reference: http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol
......@@ -58,7 +58,7 @@
var e;
if (window.MessageEvent) {
e = document.createEvent("MessageEvent");
e.initMessageEvent("message", false, false, data, null, null, window);
e.initMessageEvent("message", false, false, data, null, null, window, null);
} else { // IE
e = {data: data};
}
......@@ -69,6 +69,14 @@
}
});
self.__flash.addEventListener("error", function(fe) {
try {
if (self.onerror) self.onerror();
} catch (e) {
console.error(e.toString());
}
});
self.__flash.addEventListener("stateChange", function(fe) {
try {
self.readyState = fe.getReadyState();
......@@ -242,7 +250,8 @@
WebSocket.CONNECTING = 0;
WebSocket.OPEN = 1;
WebSocket.CLOSED = 2;
WebSocket.CLOSING = 2;
WebSocket.CLOSED = 3;
WebSocket.__tasks = [];
......@@ -293,14 +302,14 @@
}
// called from Flash
function webSocketLog(message) {
window.webSocketLog = function(message) {
console.log(decodeURIComponent(message));
}
};
// called from Flash
function webSocketError(message) {
window.webSocketError = function(message) {
console.error(decodeURIComponent(message));
}
};
/*
if (window.addEventListener) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment