示例#1
0
        public override void OnText(IWebSocketConnection sender, TextFrameEventArgs args)
        {
            //Echo the text back to the client
            sender.SendText(args.Message);

            base.OnText(sender, args);
        }
示例#2
0
 private void textControl1_TextFrameDeactivated(object sender, TextFrameEventArgs e)
 {
     if (e.TextFrame.Name == "FN")
     {
         textControl1.EditMode = EditMode.Edit;
     }
 }
示例#3
0
        private static void Client_TextFrame(object sender, TextFrameEventArgs e)
        {
            _logger.Information(typeof(MainWindow), "Client: {0}", e.Text);
            var client = (ChatWebSocketClient)sender;

            // lets test the close handshake
            client.Dispose();
        }
示例#4
0
        private static void Client_TextFrame(object sender, TextFrameEventArgs e)
        {
            Trace.TraceInformation("Client: {0}", e.Text);
            var client = (ChatWebSocketClient)sender;

            // lets test the close handshake
            client.Dispose();
        }
示例#5
0
        public override void OnText(IWebSocketConnection sender, TextFrameEventArgs args)
        {
            Logger.Info($"{sender.ClientIdentifier}/{sender.UniqueIdentifier} sent {args.Message.Length * 2} bytes");

            ConnectionManager.Broadcast(args.Message);

            base.OnText(sender, args);
        }
示例#6
0
        /// <summary>
        /// Called when [text].
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="args">The <see cref="TextFrameEventArgs"/> instance containing the event data.</param>
        public override void OnText(IWebSocketConnection sender, TextFrameEventArgs args)
        {
            ISignal signal = JsonConvert.DeserializeObject <Signal>(args.Message);

            if (signal.Sender != sender.ClientIdentifier)
            {
                Logger.Warn($"Signal from {sender.ClientIdentifier} sent with spoofed sender ({signal.Sender}). Forcibly setting to connection's client identifier.");

                signal.Sender = sender.ClientIdentifier;
            }

            signal.SenderIdentifier = sender.UniqueIdentifier;

            try
            {
                _signalRouter.Route(signal);
            }
            catch (InvalidExtensionException ex)
            {
                Logger.Error(ex);
            }

            base.OnText(sender, args);
        }
示例#7
0
 private void FrameBuilder_OnTextFrame(object sender, TextFrameEventArgs e)
 {
     base.OnTextFrame(e.Text);
 }
示例#8
0
 /// <summary>
 /// Called when [text].
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="args">The <see cref="T:PWebSocketServer.Common.Events.TextFrameEventArgs" /> instance containing the event data.</param>
 public virtual void OnText(IWebSocketConnection sender, TextFrameEventArgs args)
 {
 }