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.OpCodeprivate final NanoHTTPD.IHTTPSessionprivate final NanoHTTPD.Responseprivate final InputStreamprivate OutputStreamprivate NanoWSD.State -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose(NanoWSD.WebSocketFrame.CloseCode code, String reason, boolean initiatedByRemote) protected voidDebug method.protected voidDebug method.private voiddoClose(NanoWSD.WebSocketFrame.CloseCode code, String reason, boolean initiatedByRemote) private voidprivate voidprivate voidbooleanisOpen()protected abstract voidonClose(NanoWSD.WebSocketFrame.CloseCode code, String reason, boolean initiatedByRemote) protected abstract voidonException(IOException exception) protected abstract voidonMessage(NanoWSD.WebSocketFrame message) protected abstract voidonOpen()protected abstract voidonPong(NanoWSD.WebSocketFrame pong) voidping(byte[] payload) private voidvoidsend(byte[] payload) voidvoidsendFrame(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
-