Skip to content

Commit eee48d1

Browse files
committed
minor changes and cleanup
1 parent b20ddca commit eee48d1

3 files changed

Lines changed: 5 additions & 22 deletions

File tree

‎example/ChatServer.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
public class ChatServer extends WebSocketServer {
1515

1616
public ChatServer( int port ) throws UnknownHostException {
17-
super( new InetSocketAddress( InetAddress.getLocalHost(), port ) );
17+
super( new InetSocketAddress( InetAddress.getByName( "localhost" ), port ) );
1818
}
1919

2020
public ChatServer( InetSocketAddress address ) {

‎src/net/tootallnate/websocket/WebSocket.java‎

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -46,27 +46,10 @@ public enum Role {
4646
*/
4747
public static final int DEFAULT_PORT = 80;
4848

49-
/**
50-
* The byte representing CR, or Carriage Return, or \r
51-
*/
52-
public static final byte CR = (byte) 0x0D;
53-
/**
54-
* The byte representing LF, or Line Feed, or \n
55-
*/
56-
public static final byte LF = (byte) 0x0A;
57-
/**
58-
* The byte representing the beginning of a WebSocket text frame.
59-
*/
60-
public static final byte START_OF_FRAME = (byte) 0x00;
61-
/**
62-
* The byte representing the end of a WebSocket text frame.
63-
*/
64-
public static final byte END_OF_FRAME = (byte) 0xFF;
65-
6649
public static/*final*/boolean DEBUG = false; // must be final in the future in order to take advantage of VM optimization
6750

6851
/**
69-
* Internally used to determine whether to recieve data as part of the
52+
* Internally used to determine whether to receive data as part of the
7053
* remote handshake, or as part of a text frame.
7154
*/
7255
private boolean handshakeComplete;
@@ -97,7 +80,7 @@ public enum Role {
9780

9881
private int flash_policy_index = 0;
9982

100-
SocketChannel sockchannel;
83+
private SocketChannel sockchannel;
10184

10285
// CONSTRUCTOR /////////////////////////////////////////////////////////////
10386
/**

‎src/net/tootallnate/websocket/WebSocketServer.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ public void sendToAllExcept( Set<WebSocket> connections, String text ) throws In
175175
*
176176
* @return The currently connected clients in a WebSocket[].
177177
*/
178-
public WebSocket[] connections() {
179-
return this.connections.toArray( new WebSocket[ 0 ] );
178+
public Set<WebSocket> connections() {
179+
return Collections.unmodifiableSet( this.connections );
180180
}
181181

182182
/**

0 commit comments

Comments
 (0)