From 5b51f3c78fbb1c99fdeeeb342cedf1cce5cadd9d Mon Sep 17 00:00:00 2001 From: Simeon Bateman Date: Tue, 22 Feb 2011 18:01:06 -0800 Subject: Updated WebSocket.as to use interface instead of implementation class. Updated WebSocketMain to implement IWebSocketWrapper. Created IWebSocketWrapper --- flash-src/IWebSocketWrapper.as | 10 ++++++++++ flash-src/WebSocket.as | 4 ++-- flash-src/WebSocketMain.as | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 flash-src/IWebSocketWrapper.as diff --git a/flash-src/IWebSocketWrapper.as b/flash-src/IWebSocketWrapper.as new file mode 100644 index 0000000..06bebcd --- /dev/null +++ b/flash-src/IWebSocketWrapper.as @@ -0,0 +1,10 @@ +package { + + public interface IWebSocketWrapper { + function getOrigin():String; + function getCallerHost():String; + function log(message:String):void; + function fatal(message:String):void; + function error(message:String):void; + } +} \ No newline at end of file diff --git a/flash-src/WebSocket.as b/flash-src/WebSocket.as index 0733570..130a086 100644 --- a/flash-src/WebSocket.as +++ b/flash-src/WebSocket.as @@ -34,7 +34,7 @@ public class WebSocket extends EventDispatcher { private var tlsSocket:TLSSocket; private var tlsConfig:TLSConfig; private var socket:Socket; - private var main:WebSocketMain; + private var main:IWebSocketWrapper; private var url:String; private var scheme:String; private var host:String; @@ -51,7 +51,7 @@ public class WebSocket extends EventDispatcher { private var expectedDigest:String; public function WebSocket( - main:WebSocketMain, url:String, protocol:String, + main:IWebSocketWrapper, url:String, protocol:String, proxyHost:String = null, proxyPort:int = 0, headers:String = null) { this.main = main; diff --git a/flash-src/WebSocketMain.as b/flash-src/WebSocketMain.as index 9d6ff90..6dc0517 100644 --- a/flash-src/WebSocketMain.as +++ b/flash-src/WebSocketMain.as @@ -17,7 +17,7 @@ import mx.events.*; import mx.utils.*; import bridge.FABridge; -public class WebSocketMain extends Sprite { +public class WebSocketMain extends Sprite implements IWebSocketWrapper{ private var callerUrl:String; private var debug:Boolean = false; -- cgit v1.2.1