Skip to content

Commit 390c403

Browse files
committed
added function Websocket::close(void) for convenience so that it is not necessary to pass a closecode (TooTallNate#151)
1 parent 7d4d69a commit 390c403

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/main/java/org/java_websocket/WebSocket.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ public enum READYSTATE {
3333

3434
public void close( int code );
3535

36+
/** Convenience function which behaves like close(CloseFrame.NORMAL) */
37+
public void close();
38+
3639
/**
3740
* This will close the connection immediately without a proper close handshake.
3841
* The code and the message therefore won't be transfered over the wire also they will be forwarded to onClose/onWebsocketClose.

src/main/java/org/java_websocket/WebSocketImpl.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,4 +704,9 @@ public Draft getDraft() {
704704
return draft;
705705
}
706706

707+
@Override
708+
public void close() {
709+
close( CloseFrame.NORMAL );
710+
}
711+
707712
}

0 commit comments

Comments
 (0)