Package fi.iki.elonen
Class NanoWSD.WebSocket
java.lang.Object
fi.iki.elonen.NanoWSD.WebSocket
- Direct Known Subclasses:
DebugWebSocketServer.DebugWebSocket
- Enclosing class:
NanoWSD
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List
<NanoWSD.WebSocketFrame> private NanoWSD.WebSocketFrame.OpCode
private final NanoHTTPD.IHTTPSession
private final NanoHTTPD.Response
private final InputStream
private OutputStream
private NanoWSD.State
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close
(NanoWSD.WebSocketFrame.CloseCode code, String reason, boolean initiatedByRemote) protected void
Debug method.protected void
Debug method.private void
doClose
(NanoWSD.WebSocketFrame.CloseCode code, String reason, boolean initiatedByRemote) private void
private void
private void
boolean
isOpen()
protected abstract void
onClose
(NanoWSD.WebSocketFrame.CloseCode code, String reason, boolean initiatedByRemote) protected abstract void
onException
(IOException exception) protected abstract void
onMessage
(NanoWSD.WebSocketFrame message) protected abstract void
onOpen()
protected abstract void
onPong
(NanoWSD.WebSocketFrame pong) void
ping
(byte[] payload) private void
void
send
(byte[] payload) void
void
sendFrame
(NanoWSD.WebSocketFrame frame)
-
Field Details
-
in
-
out
-
continuousOpCode
-
continuousFrames
-
state
-
handshakeRequest
-
handshakeResponse
-
-
Constructor Details
-
WebSocket
-
-
Method Details
-
isOpen
public boolean isOpen() -
onOpen
protected abstract void onOpen() -
onClose
protected abstract void onClose(NanoWSD.WebSocketFrame.CloseCode code, String reason, boolean initiatedByRemote) -
onMessage
-
onPong
-
onException
-
debugFrameReceived
Debug method. Do not Override unless for debug purposes!- Parameters:
frame
- The received WebSocket Frame.
-
debugFrameSent
Debug method. Do not Override unless for debug purposes!
This method is called before actually sending the frame.- Parameters:
frame
- The sent WebSocket Frame.
-
close
public void close(NanoWSD.WebSocketFrame.CloseCode code, String reason, boolean initiatedByRemote) throws IOException - Throws:
IOException
-
doClose
private void doClose(NanoWSD.WebSocketFrame.CloseCode code, String reason, boolean initiatedByRemote) -
getHandshakeRequest
-
getHandshakeResponse
-
handleCloseFrame
- Throws:
IOException
-
handleFrameFragment
- Throws:
IOException
-
handleWebsocketFrame
- Throws:
IOException
-
ping
- Throws:
IOException
-
readWebsocket
private void readWebsocket() -
send
- Throws:
IOException
-
send
- Throws:
IOException
-
sendFrame
- Throws:
IOException
-