Exemplo n.º 1
0
 private static void ClientOnMessageSent(object sender, MessageEventArgs args)
 {
     var textMessage = args.Message as TextMessage;
     if (textMessage != null) {
         Console.WriteLine("SENT: {0}", textMessage.Text);
     } else {
         Console.WriteLine("SENT: {0}", args.Message.GetType());
     }
 }
Exemplo n.º 2
0
        protected override void ClientOnMessageSent(object sender, MessageEventArgs args)
        {
            base.ClientOnMessageSent(sender, args);
            var client = sender as IServerClient;
            if (client == null) {
                throw new ArgumentNullException("sender", "Internal server error - sender-client can not be null");
            }

            // Simple debug
            var textMessage = args.Message as TextMessage;
            if (textMessage != null) {
                ServerConsole.DebugLine("[{0}] SENT: {1}", client.RemoteEndPoint, textMessage.Text);
            } else {
                ServerConsole.DebugLine("[{0}] SENT: {1}", client.RemoteEndPoint, args.Message.GetType());
            }
        }
Exemplo n.º 3
0
 /// <summary>
 ///     Handles MessageSent event of _communicationChannel object.
 /// </summary>
 /// <param name="sender">Source of event</param>
 /// <param name="e">Event arguments</param>
 private void CommunicationChannel_MessageSent(object sender, MessageEventArgs e)
 {
     OnMessageSent(e.Message);
 }
Exemplo n.º 4
0
        /// <summary>
        ///     Handles MessageReceived event of _communicationChannel object.
        /// </summary>
        /// <param name="sender">Source of event</param>
        /// <param name="e">Event arguments</param>
        private void CommunicationChannel_MessageReceived(object sender, MessageEventArgs e)
        {
            if (e.Message is PingMessage) {
                return;
            }

            OnMessageReceived(e.Message);
        }
Exemplo n.º 5
0
        /// <summary>
        ///     Handles MessageReceived event of _communicationChannel object.
        /// </summary>
        /// <param name="sender">Source of event</param>
        /// <param name="e">Event arguments</param>
        private void CommunicationChannel_MessageReceived(object sender, MessageEventArgs e)
        {
            var message = e.Message;
            if (message is PingMessage) {
                _communicationChannel.SendMessage(new PingMessage {
                    RepliedId = message.Id
                });
                return;
            }

            OnMessageReceived(message);
        }
Exemplo n.º 6
0
 protected virtual void ClientOnMessageSent(object sender, MessageEventArgs args)
 {
 }