Skip to content

Commit e861a2a

Browse files
committed
-made example code working
1 parent 9f9f86e commit e861a2a

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

example/ChatClient.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,24 @@
66
import java.io.IOException;
77
import java.net.URI;
88
import java.net.URISyntaxException;
9+
910
import javax.swing.JButton;
1011
import javax.swing.JFrame;
1112
import javax.swing.JScrollPane;
1213
import javax.swing.JTextArea;
1314
import javax.swing.JTextField;
1415

16+
import net.tootallnate.websocket.Draft;
1517
import net.tootallnate.websocket.WebSocketClient;
16-
import net.tootallnate.websocket.WebSocketDraft;
18+
import net.tootallnate.websocket.drafts.Draft_10;
1719

1820
/**
1921
* A barebones chat client that uses the WebSocket protocol.
2022
*/
2123
public class ChatClient extends WebSocketClient {
2224
private final JTextArea ta;
2325

24-
public ChatClient(URI uri, JTextArea ta, WebSocketDraft draft) {
26+
public ChatClient(URI uri, JTextArea ta, Draft draft) {
2527
super(uri, draft);
2628
this.ta = ta;
2729
}
@@ -121,7 +123,7 @@ public void actionPerformed(ActionEvent e) {
121123
connect.setEnabled(false);
122124
uriField.setEditable(false);
123125
try {
124-
cc = new ChatClient(new URI(uriField.getText()), area, WebSocketDraft.DRAFT76);
126+
cc = new ChatClient(new URI(uriField.getText()), area, new Draft_10() );
125127
cc.connect();
126128
} catch (URISyntaxException ex) {
127129
area.append(uriField.getText() + " is not a valid WebSocket URI\n");

example/ChatServer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public void onClientMessage(WebSocket conn, String message) {
3939
System.out.println(conn + ": " + message);
4040
}
4141

42-
public void onIOError(IOException ex) {
42+
public void onError(Throwable ex) {
4343
ex.printStackTrace();
4444
}
4545

0 commit comments

Comments
 (0)