Is there a way to keep state on a Channel. I’m writing a chat server and I want to keep information about the user that a Channel belongs to. I was thinking maybe Channel would provide a method to store a user object, but I can’t see one. Is there a way to do this without needing something like a Map?
Share
1)You can set the state information in the channelHandlerContext, like below, and use it later.
2)Create a channel local and store state information there (channel local is like a thread local to specific a channel)