Skip to content

Commit 61b9fb7

Browse files
committed
merge endpoint/namespace fix from clwillingham, which uses webSocket.getNamespace()
2 parents 7f7ab05 + 9be98b3 commit 61b9fb7

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

LICENSE

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright (c) 2012 Chris Willingham <[email protected]>
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

src/main/java/com/clwillingham/socket/io/IOSocket.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,29 +72,30 @@ public void emit(String event, JSONObject... message) throws IOException, Interr
7272
}
7373
data.put("name", event);
7474
data.put("args", args);
75-
IOMessage packet = new IOMessage(IOMessage.EVENT, "", data.toString());
75+
IOMessage packet = new IOMessage(IOMessage.EVENT, webSocket.getNamespace(), data.toString());
7676
webSocket.sendMessage(packet);
7777
} catch (JSONException e) {
7878
// TODO Auto-generated catch block
7979
e.printStackTrace();
8080
}
8181
}
8282

83+
8384
public void send(String endpoint, JSONObject message) throws IOException, InterruptedException {
84-
IOMessage packet = new IOMessage(IOMessage.JSONMSG, endpoint, message.toString());
85+
IOMessage packet = new IOMessage(IOMessage.JSONMSG, webSocket.getNamespace(), message.toString());
8586
webSocket.sendMessage(packet);
8687
}
87-
88+
8889
public void send(String message) throws IOException, InterruptedException {
89-
IOMessage packet = new IOMessage(IOMessage.MESSAGE, "", message);
90+
IOMessage packet = new IOMessage(IOMessage.MESSAGE, webSocket.getNamespace(), message);
9091
webSocket.sendMessage(packet);
9192
}
9293

9394
public synchronized void disconnect() {
9495
if (connected) {
9596
try {
9697
if (open) {
97-
webSocket.sendMessage(new IOMessage(IOMessage.DISCONNECT, "", ""));
98+
webSocket.sendMessage(new IOMessage(IOMessage.DISCONNECT, webSocket.getNamespace(), ""));
9899
}
99100
} catch (IOException e) {
100101
e.printStackTrace();

0 commit comments

Comments
 (0)