Package org.openmuc.jship.node.websocket
Class WebSocketHandler
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelInboundHandlerAdapter
-
- io.netty.channel.SimpleChannelInboundHandler<java.lang.Object>
-
- org.openmuc.jship.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 BasicCallBack
basicCB
protected io.netty.channel.Channel
ch
protected ShipConnection
connection
protected org.slf4j.Logger
log
protected ShipNodeContext
nodeCtx
protected boolean
pongReceived
protected java.util.concurrent.CountDownLatch
shipConnRdyLatch
protected WebSocketCallBack
socketCB
-
Constructor Summary
Constructors Modifier Constructor Description protected
WebSocketHandler(ShipNodeContext nodeCtx, WebSocketCallBack socketCB)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
checkDoubleConn(java.lang.String peerSki)
abstract void
close()
ShipConnection
getConnection()
java.lang.String
getPeerSki()
java.lang.String
getRemoteAddr()
java.lang.String
getRemoteHost()
protected int
getTrustLevel()
protected void
handlePingPongFrame(io.netty.handler.codec.http.websocketx.WebSocketFrame frame)
protected byte[]
handleWebSocketFrame(io.netty.handler.codec.http.websocketx.WebSocketFrame frame)
protected boolean
isPingPongFrame(io.netty.handler.codec.http.websocketx.WebSocketFrame frame)
boolean
isShipConnRdy(int timeout)
protected void
sendMsg(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
-
-
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()
-
getRemoteAddr
public java.lang.String getRemoteAddr()
-
getRemoteHost
public java.lang.String getRemoteHost()
-
checkDoubleConn
protected void checkDoubleConn(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()
-
-