Hi,
Michael Ramirez wrote:
> Dear Mina-Dev,
>
> How does MINA handle state changes? I am writing a similar framework
for Actionscript. Upon connection the server sends a Handshake packet
then the client needs to send a Client Auth Packet then the server sends
an Ok or Error packet, etc. How does MINA decide which encoder/decoder
to use?
>
>
> Michael Ramirez
>
>
> ---------------------------------
> Yahoo! Messenger with Voice. PC-to-Phone calls for ridiculously low
rates.
I'll try to give you a first answer. Normally you will handle all the
received messages in your derived IoSession. So here could be one place
to check for different message types and react on them.
The other possibility is to use a derived DemuxingProtocolCodecFactory
and register different codecs here, which handle separately the incoming
data (parsing of ByteBuffer / decision for correct codec to use /
conversion into MessageObjects -> ProtocolDecoderOutput) ... see also
the SumUp example
The second case make it easy to handle the incoming messages as objects
instead of nontyped ByteBuffer queue over a simple switch case statement
in IoSession.
Possibly you can handle (respond to sender) some of the simpler messages
directly in the codecs itself without handling them extra in IoSession?
@community: Correct? ;)
Regards
Michael