Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Making it possible to close() when readyState == CONNECTING.

  • Loading branch information...
commit 6234403f799f1784958464eb92edf1021101a1af 1 parent 53b0887
@gimite gimite authored
View
BIN  WebSocketMain.swf
Binary file not shown
View
BIN  WebSocketMainInsecure.zip
Binary file not shown
View
8 flash-src/WebSocket.as
@@ -133,9 +133,11 @@ public class WebSocket extends EventDispatcher {
main.log("close");
dataQueue = [];
try {
- socket.writeByte(0xff);
- socket.writeByte(0x00);
- socket.flush();
+ if (readyState == OPEN) {
+ socket.writeByte(0xff);
+ socket.writeByte(0x00);
+ socket.flush();
+ }
socket.close();
} catch (ex:Error) { }
readyState = CLOSED;
View
2  web_socket.js
@@ -120,7 +120,7 @@
var self = this;
if (!self.__flash) return;
self.readyState = self.__flash.getReadyState();
- if (self.readyState != WebSocket.OPEN) return;
+ if (self.readyState == WebSocket.CLOSED || self.readyState == WebSocket.CLOSING) return;
self.__flash.close();
// Sets/calls them manually here because Flash WebSocketConnection.close cannot fire events
// which causes weird error:
Please sign in to comment.
Something went wrong with that request. Please try again.