コード例 #1
0
        /// <summary> <p>Receives a message (from the server) and process it.</p>
        /// <p>Processing the message involves calling the receive {@link ClientSession.Extension extensions}
        /// and the channel {@link ClientSessionChannel.ClientSessionChannelListener listeners}.</p>
        /// </summary>
        /// <param name="message">the message received.
        /// </param>
        /// <param name="mutable">the mutable version of the message received
        /// </param>
        public void receive(IMutableMessage message)
        {
            String id = message.Channel;

            if (id == null)
            {
                throw new ArgumentException("Bayeux messages must have a channel, " + message);
            }

            if (!extendRcv(message))
            {
                return;
            }

            AbstractSessionChannel channel = (AbstractSessionChannel)getChannel(id);
            ChannelId channelId            = channel.ChannelId;

            channel.notifyMessageListeners(message);

            foreach (String channelPattern in channelId.Wilds)
            {
                ChannelId channelIdPattern = newChannelId(channelPattern);
                if (channelIdPattern.matches(channelId))
                {
                    AbstractSessionChannel wildChannel = (AbstractSessionChannel)getChannel(channelPattern);
                    wildChannel.notifyMessageListeners(message);
                }
            }
        }