I have an architecture based on micro services, netty io runs on a spring boot application, when I want to send a message to a client I have to wait for a message from the client to send the reply to the one I want to send. How could I send a message to the client without waiting for him to communicate with me? I'm lost in this step.
You can process like that :
ctx.channel()
) channelInactive
event to remove the reference when the client disconnects Instead of waiting for a HelloMessage, you can also catch the channelActive
event but it is fired each time somebody connects to your listened port, even if is not one of your client. That's why I prefer using an "Hello Message"
Now, you have a reference on the channel and you can send a message when you want by calling channel.writeAndFlush()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.