| | |
| | | import org.greenrobot.eventbus.Subscribe; |
| | | import org.greenrobot.eventbus.ThreadMode; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | | public class NettyServerHandler extends ChannelInboundHandlerAdapter { |
| | |
| | | } |
| | | |
| | | public static void sendMessageToClient(String clientId, byte[] message) { |
| | | |
| | | Channel channel = channelMap.get(clientId); |
| | | if (channel != null && channel.isActive()) { |
| | | ByteBuf buf = Unpooled.wrappedBuffer(message); |
| | |
| | | } else { |
| | | Log.d(TAG, "Client " + clientId + " is not connected"); |
| | | } |
| | | |
| | | Log.d(TAG, "Client " + clientId + " is not connected"); |
| | | } |
| | | |
| | | @Override |