Class WebSocketHandler
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelInboundHandlerAdapter
-
- io.netty.channel.SimpleChannelInboundHandler<java.lang.Object>
-
- org.openmuc.jeebus.ship.node.websocket.WebSocketHandler
-
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler
- Direct Known Subclasses:
ShipClientHandler,ShipServerHandler
public abstract class WebSocketHandler extends io.netty.channel.SimpleChannelInboundHandler<java.lang.Object>
-
-
Field Summary
Fields Modifier and Type Field Description protected BasicCallBackbasicCBprotected io.netty.channel.Channelchprotected ShipConnectionconnectionprotected org.slf4j.Loggerlogprotected java.io.ByteArrayOutputStreammessageBufferprotected ShipNodeContextnodeCtxprotected booleanpongReceivedprotected java.util.concurrent.CountDownLatchshipConnRdyLatchprotected WebSocketCallBacksocketCB
-
Constructor Summary
Constructors Modifier Constructor Description protectedWebSocketHandler(ShipNodeContext nodeCtx, WebSocketCallBack socketCB)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidclose()protected voiddoubleConnProcedure(java.lang.String peerSki)ShipConnectiongetConnection()java.lang.StringgetPeerSki()java.lang.StringgetRemoteHost()java.lang.StringgetRemoteIpAndPort()protected intgetTrustLevel()protected voidhandlePingPongFrame(io.netty.handler.codec.http.websocketx.WebSocketFrame frame)protected byte[]handleWebSocketFrame(io.netty.handler.codec.http.websocketx.WebSocketFrame frame)protected booleanisPingPongFrame(io.netty.handler.codec.http.websocketx.WebSocketFrame frame)booleanisShipConnRdy(int timeout)protected voidsendMsg(byte[] msg)-
Methods inherited from class io.netty.channel.SimpleChannelInboundHandler
acceptInboundMessage, channelRead, channelRead0
-
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered
-
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
-
-
-
-
Field Detail
-
log
protected final org.slf4j.Logger log
-
socketCB
protected final WebSocketCallBack socketCB
-
nodeCtx
protected ShipNodeContext nodeCtx
-
connection
protected ShipConnection connection
-
basicCB
protected BasicCallBack basicCB
-
ch
protected io.netty.channel.Channel ch
-
shipConnRdyLatch
protected java.util.concurrent.CountDownLatch shipConnRdyLatch
-
pongReceived
protected boolean pongReceived
-
messageBuffer
protected final java.io.ByteArrayOutputStream messageBuffer
-
-
Constructor Detail
-
WebSocketHandler
protected WebSocketHandler(ShipNodeContext nodeCtx, WebSocketCallBack socketCB)
-
-
Method Detail
-
sendMsg
protected void sendMsg(byte[] msg)
-
isPingPongFrame
protected boolean isPingPongFrame(io.netty.handler.codec.http.websocketx.WebSocketFrame frame)
-
handlePingPongFrame
protected void handlePingPongFrame(io.netty.handler.codec.http.websocketx.WebSocketFrame frame)
-
handleWebSocketFrame
protected byte[] handleWebSocketFrame(io.netty.handler.codec.http.websocketx.WebSocketFrame frame)
-
getTrustLevel
protected int getTrustLevel()
-
getPeerSki
public java.lang.String getPeerSki()
-
getRemoteIpAndPort
public java.lang.String getRemoteIpAndPort()
-
getRemoteHost
public java.lang.String getRemoteHost()
-
doubleConnProcedure
protected void doubleConnProcedure(java.lang.String peerSki)
-
isShipConnRdy
public boolean isShipConnRdy(int timeout) throws java.lang.InterruptedException- Throws:
java.lang.InterruptedException
-
getConnection
public ShipConnection getConnection()
-
close
public abstract void close()
-
-