How do I choose between handlerAdded and channelActive when the web client reaches my websocket server?

My program has a websocket server. The server connects the client connection in two ways: "handlerAdded" and "channelActive". What should I use when the web client arrives?

+4
source share
1 answer

ChannelActiverecommended, while in the server context handlerAddedthey ChannelActiveare called one after another, when you transfer the handler to the client side, it handlerAddedis called before the call ChannelActive, which makes your code an error, since the record does not work until the channel is active.

Q handlerAdded: channel().isActive() there is either true or false

ChannelActive: channel().isActive() *

, channel().isActive() .

+2

Source: https://habr.com/ru/post/1626316/


All Articles