diff --git a/websocket-sharp.userprefs b/websocket-sharp.userprefs index a1f5581c..6c25aa51 100644 --- a/websocket-sharp.userprefs +++ b/websocket-sharp.userprefs @@ -1,8 +1,8 @@  - + - + diff --git a/websocket-sharp/WebSocket.cs b/websocket-sharp/WebSocket.cs index 779a4197..90ba1ab1 100644 --- a/websocket-sharp/WebSocket.cs +++ b/websocket-sharp/WebSocket.cs @@ -53,6 +53,8 @@ namespace WebSocketSharp get { return uri.ToString(); } } + private Object sync = new Object(); + private volatile WsState readyState; public WsState ReadyState { @@ -63,17 +65,18 @@ namespace WebSocketSharp switch (value) { case WsState.OPEN: + readyState = value; if (OnOpen != null) { OnOpen(this, EventArgs.Empty); } - goto default; + break; case WsState.CLOSING: case WsState.CLOSED: - close(value); - break; - default: - readyState = value; + lock(sync) + { + close(value); + } break; } } diff --git a/websocket-sharp/bin/Debug/websocket-sharp.dll b/websocket-sharp/bin/Debug/websocket-sharp.dll index 41001b3a..d89cb927 100755 Binary files a/websocket-sharp/bin/Debug/websocket-sharp.dll and b/websocket-sharp/bin/Debug/websocket-sharp.dll differ diff --git a/websocket-sharp/bin/Debug/websocket-sharp.dll.mdb b/websocket-sharp/bin/Debug/websocket-sharp.dll.mdb index ca151b40..6bad5847 100644 Binary files a/websocket-sharp/bin/Debug/websocket-sharp.dll.mdb and b/websocket-sharp/bin/Debug/websocket-sharp.dll.mdb differ diff --git a/websocket-sharp/bin/Debug_Ubuntu/websocket-sharp.dll b/websocket-sharp/bin/Debug_Ubuntu/websocket-sharp.dll index 7136652b..169f4103 100755 Binary files a/websocket-sharp/bin/Debug_Ubuntu/websocket-sharp.dll and b/websocket-sharp/bin/Debug_Ubuntu/websocket-sharp.dll differ diff --git a/websocket-sharp/bin/Debug_Ubuntu/websocket-sharp.dll.mdb b/websocket-sharp/bin/Debug_Ubuntu/websocket-sharp.dll.mdb index 6c2c977a..962b5374 100644 Binary files a/websocket-sharp/bin/Debug_Ubuntu/websocket-sharp.dll.mdb and b/websocket-sharp/bin/Debug_Ubuntu/websocket-sharp.dll.mdb differ diff --git a/websocket-sharp/bin/Release/websocket-sharp.dll b/websocket-sharp/bin/Release/websocket-sharp.dll index 7efae5ab..0ab8c167 100755 Binary files a/websocket-sharp/bin/Release/websocket-sharp.dll and b/websocket-sharp/bin/Release/websocket-sharp.dll differ diff --git a/websocket-sharp/bin/Release_Ubuntu/websocket-sharp.dll b/websocket-sharp/bin/Release_Ubuntu/websocket-sharp.dll index 7d0e2a0c..a8ac0450 100755 Binary files a/websocket-sharp/bin/Release_Ubuntu/websocket-sharp.dll and b/websocket-sharp/bin/Release_Ubuntu/websocket-sharp.dll differ diff --git a/websocket-sharp/websocket-sharp.pidb b/websocket-sharp/websocket-sharp.pidb index 43599e05..49eb985d 100644 Binary files a/websocket-sharp/websocket-sharp.pidb and b/websocket-sharp/websocket-sharp.pidb differ diff --git a/wsclient/bin/Debug/websocket-sharp.dll b/wsclient/bin/Debug/websocket-sharp.dll index 41001b3a..d89cb927 100755 Binary files a/wsclient/bin/Debug/websocket-sharp.dll and b/wsclient/bin/Debug/websocket-sharp.dll differ diff --git a/wsclient/bin/Debug/websocket-sharp.dll.mdb b/wsclient/bin/Debug/websocket-sharp.dll.mdb index ca151b40..6bad5847 100644 Binary files a/wsclient/bin/Debug/websocket-sharp.dll.mdb and b/wsclient/bin/Debug/websocket-sharp.dll.mdb differ diff --git a/wsclient/bin/Debug/wsclient.exe b/wsclient/bin/Debug/wsclient.exe index 9d0c0fa3..cb4059b5 100755 Binary files a/wsclient/bin/Debug/wsclient.exe and b/wsclient/bin/Debug/wsclient.exe differ diff --git a/wsclient/bin/Debug/wsclient.exe.mdb b/wsclient/bin/Debug/wsclient.exe.mdb index d58ff448..e48d8238 100644 Binary files a/wsclient/bin/Debug/wsclient.exe.mdb and b/wsclient/bin/Debug/wsclient.exe.mdb differ diff --git a/wsclient/bin/Debug_Ubuntu/websocket-sharp.dll b/wsclient/bin/Debug_Ubuntu/websocket-sharp.dll index 7136652b..169f4103 100755 Binary files a/wsclient/bin/Debug_Ubuntu/websocket-sharp.dll and b/wsclient/bin/Debug_Ubuntu/websocket-sharp.dll differ diff --git a/wsclient/bin/Debug_Ubuntu/websocket-sharp.dll.mdb b/wsclient/bin/Debug_Ubuntu/websocket-sharp.dll.mdb index 6c2c977a..962b5374 100644 Binary files a/wsclient/bin/Debug_Ubuntu/websocket-sharp.dll.mdb and b/wsclient/bin/Debug_Ubuntu/websocket-sharp.dll.mdb differ diff --git a/wsclient/bin/Debug_Ubuntu/wsclient.exe b/wsclient/bin/Debug_Ubuntu/wsclient.exe index 304f5ee7..61d03a1c 100755 Binary files a/wsclient/bin/Debug_Ubuntu/wsclient.exe and b/wsclient/bin/Debug_Ubuntu/wsclient.exe differ diff --git a/wsclient/bin/Debug_Ubuntu/wsclient.exe.mdb b/wsclient/bin/Debug_Ubuntu/wsclient.exe.mdb index f6714016..5ba0ea75 100644 Binary files a/wsclient/bin/Debug_Ubuntu/wsclient.exe.mdb and b/wsclient/bin/Debug_Ubuntu/wsclient.exe.mdb differ diff --git a/wsclient/bin/Release/websocket-sharp.dll b/wsclient/bin/Release/websocket-sharp.dll index 7efae5ab..0ab8c167 100755 Binary files a/wsclient/bin/Release/websocket-sharp.dll and b/wsclient/bin/Release/websocket-sharp.dll differ diff --git a/wsclient/bin/Release/wsclient.exe b/wsclient/bin/Release/wsclient.exe index 97e52216..79f91b15 100755 Binary files a/wsclient/bin/Release/wsclient.exe and b/wsclient/bin/Release/wsclient.exe differ diff --git a/wsclient/bin/Release_Ubuntu/websocket-sharp.dll b/wsclient/bin/Release_Ubuntu/websocket-sharp.dll index 7d0e2a0c..a8ac0450 100755 Binary files a/wsclient/bin/Release_Ubuntu/websocket-sharp.dll and b/wsclient/bin/Release_Ubuntu/websocket-sharp.dll differ diff --git a/wsclient/bin/Release_Ubuntu/wsclient.exe b/wsclient/bin/Release_Ubuntu/wsclient.exe index 06b8c077..58563e43 100755 Binary files a/wsclient/bin/Release_Ubuntu/wsclient.exe and b/wsclient/bin/Release_Ubuntu/wsclient.exe differ diff --git a/wsclient/wsclient.cs b/wsclient/wsclient.cs index e7b988ec..257a0172 100644 --- a/wsclient/wsclient.cs +++ b/wsclient/wsclient.cs @@ -14,11 +14,11 @@ namespace Example //using (WebSocket ws = new WebSocket("ws://localhost:8000/")) using (WebSocket ws = new WebSocket("ws://localhost:8000/", "chat")) { - /*ws.OnOpen += (o, e) => + ws.OnOpen += (o, e) => { - //Do something. + ws.Send("Hi, all!"); }; - */ + ws.OnMessage += (o, s) => { #if NOTIFY diff --git a/wsclient/wsclient.pidb b/wsclient/wsclient.pidb index 77dd8daa..3175c85f 100644 Binary files a/wsclient/wsclient.pidb and b/wsclient/wsclient.pidb differ diff --git a/wsclient1/bin/Release_Ubuntu/websocket-sharp.dll b/wsclient1/bin/Release_Ubuntu/websocket-sharp.dll index 7d0e2a0c..a8ac0450 100755 Binary files a/wsclient1/bin/Release_Ubuntu/websocket-sharp.dll and b/wsclient1/bin/Release_Ubuntu/websocket-sharp.dll differ diff --git a/wsclient1/bin/Release_Ubuntu/wsclient1.exe b/wsclient1/bin/Release_Ubuntu/wsclient1.exe index 98bfdc40..4b717110 100755 Binary files a/wsclient1/bin/Release_Ubuntu/wsclient1.exe and b/wsclient1/bin/Release_Ubuntu/wsclient1.exe differ