Package org.fisco.bcos.sdk.channel
Class ChannelMsgHandler
java.lang.Object
org.fisco.bcos.sdk.channel.ChannelMsgHandler
- All Implemented Interfaces:
MsgHandler
public class ChannelMsgHandler extends java.lang.Object implements MsgHandler
An implementation of channel.
-
Constructor Summary
Constructors Constructor Description ChannelMsgHandler() -
Method Summary
Modifier and Type Method Description voidaddConnectHandler(MsgHandler handler)voidaddDisconnectHandler(MsgHandler handler)voidaddEstablishHandler(MsgHandler handler)voidaddMessageHandler(MsgType type, MsgHandler handler)voidaddSeq2CallBack(java.lang.String seq, ResponseCallback callback)java.util.Map<java.lang.String,io.netty.channel.ChannelHandlerContext>getAvailablePeer()voidonConnect(io.netty.channel.ChannelHandlerContext ctx)OnConnect action.voidonDisconnect(io.netty.channel.ChannelHandlerContext ctx)OnDisconnect action Called when one connection disconnect.voidonMessage(io.netty.channel.ChannelHandlerContext ctx, Message msg)OnMessage action.voidremoveSeq(java.lang.String seq)
-
Constructor Details
-
ChannelMsgHandler
public ChannelMsgHandler()
-
-
Method Details
-
getAvailablePeer
public java.util.Map<java.lang.String,io.netty.channel.ChannelHandlerContext> getAvailablePeer() -
addConnectHandler
-
addEstablishHandler
-
addMessageHandler
-
addDisconnectHandler
-
addSeq2CallBack
-
removeSeq
public void removeSeq(java.lang.String seq) -
onConnect
public void onConnect(io.netty.channel.ChannelHandlerContext ctx)Description copied from interface:MsgHandlerOnConnect action. Called when connect success.- Specified by:
onConnectin interfaceMsgHandler- Parameters:
ctx- ChannelHandlerContext of the connection from netty
-
onMessage
Description copied from interface:MsgHandlerOnMessage action. Called when one message comes from the network.- Specified by:
onMessagein interfaceMsgHandler- Parameters:
ctx- ChannelHandlerContext of the connection from nettymsg- Message from the network
-
onDisconnect
public void onDisconnect(io.netty.channel.ChannelHandlerContext ctx)Description copied from interface:MsgHandlerOnDisconnect action Called when one connection disconnect.- Specified by:
onDisconnectin interfaceMsgHandler- Parameters:
ctx- ChannelHandlerContext of the connection from netty
-