• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# WebSocketSharp.MessageEventArgs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中WebSocketSharp.MessageEventArgs的典型用法代码示例。如果您正苦于以下问题:C# MessageEventArgs类的具体用法?C# MessageEventArgs怎么用?C# MessageEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MessageEventArgs类属于WebSocketSharp命名空间,在下文中一共展示了MessageEventArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: OnMessage

        protected override void OnMessage(MessageEventArgs e)
        {
            dynamic request = new JavaScriptSerializer().Deserialize(e.Data, typeof(object));

            switch ((string)request.action)
            {
                case "start":
                   json = new JavaScriptSerializer().Serialize(true);
                   Telemetry.Game.StartRecording();
                    break;

                case "stop":
                    Telemetry.Game.StopRecording();
                    json = new JavaScriptSerializer().Serialize(true);
                    break;

                case "analyse":
                    Telemetry.Game.AnalyseRecordingForTracks();
                 //   json = new JavaScriptSerializer().Serialize(GameState.TrackAnalysis);
                    break;

                case "loadanalysedtrack":
                    Track track = Telemetry.Game.BuildTrackData(request.name, request.lap);
                    json = new JavaScriptSerializer().Serialize(track);
                    break;

            }

            Send(json);
        }
开发者ID:Alex-developer,项目名称:AGRacing,代码行数:30,代码来源:RecordingService.cs


示例2: client_OnMessage

 public static void client_OnMessage(object sender, MessageEventArgs e)
 {
     string msg = e.Data;
     Debug.WriteLine(string.Format("wsGPS OnMessage => {0}", msg));
     //�����������Ҫ��ԭʼ����Ӧ�ñ�������֮����Ч��������ͻ���
     services.get_service(registe_name).Send(msg);
 }
开发者ID:ssor,项目名称:iotlab-native,代码行数:7,代码来源:GPS.cs


示例3: OnMessage

 protected override void OnMessage(MessageEventArgs e)
 {
     var msg = QueryString.Contains("name")
       ? String.Format("'{0}' returns to {1}", e.Data, QueryString["name"])
       : e.Data;
       Send(msg);
 }
开发者ID:kallex,项目名称:websocket-sharp,代码行数:7,代码来源:Echo.cs


示例4: OnMessage

        protected override void OnMessage(MessageEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException(nameof(e));
            }

            log.Info("Received message: \"" + e.Data + "\" of type \"" + e.Type.ToString() + "\"");

            if (string.IsNullOrEmpty(e.Data))
                return;

            using (var session = Bootstrapper.CreateSession())
            using (var transaction = session.BeginTransaction())
            {
                bool commitTransaction = HandleMessage(session, e.Data, (string message) =>
                {
                    log.Info("Sending message: " + message);
                    Send(message);
                });

                if (commitTransaction)
                    transaction.Commit();
                else
                    transaction.Rollback();
            }
        }
开发者ID:IdleLands,项目名称:IdleLandsRedux,代码行数:27,代码来源:IdleLandsBehaviour.cs


示例5: Client_Message

        private void Client_Message(MessageEventArgs e)
        {
            if (InvokeRequired)
            {
                Invoke((MethodInvoker)delegate {
                    Client_Message(e);
                });
                return;
            }

            outputText.AppendText(string.Format("Message Received on {0}:{1}",
                DateTime.Now, Environment.NewLine));

            if (e.IsBinary)
            {
                outputText.Append(e.RawData, e.RawData.Length);
            }
            else
            {
                outputText.AppendText(e.Data);
            }

            outputText.AppendText(Environment.NewLine);
            outputText.AppendText(Environment.NewLine);
        }
开发者ID:tewarid,项目名称:NetTools,代码行数:25,代码来源:ClientForm.cs


示例6: OnMessage

        protected override void OnMessage(MessageEventArgs e)
        {
            dynamic json = JsonConvert.DeserializeObject<dynamic>(e.Data);
            int type;
            try
            {
                type = Convert.ToInt16(json.type);
            }
            catch
            {
                return;
            }

            switch (type)
            {
                case 0:
                    ProcessLogin(JsonConvert.DeserializeObject<LoginRequest>(e.Data));
                    break;
                case 1:
                    ProcessCommand(JsonConvert.DeserializeObject<CommandRequest>(e.Data));
                    break;
                case 4:
                    GetBans(JsonConvert.DeserializeObject<BanListRequest>(e.Data));
                    break;
                case 5:
                    GetBEClients(JsonConvert.DeserializeObject<ClientListRequest>(e.Data));
                    break;
            }
        }
开发者ID:josemaripl,项目名称:MBCon,代码行数:29,代码来源:SocketBehavior.cs


示例7: OnMessage

 protected override void OnMessage(MessageEventArgs e)
 {
     try
     {
         switch (e.Type)
         {
             case Opcode.TEXT:
                 {
                     JArray dcode = JArray.Parse(e.Data);
                     ClientOpcode opcode = (ClientOpcode)int.Parse(dcode[0].ToString());
                     LogConsole.Show(LogType.DEBUG, "opcode: {0}", opcode);
                     Program.PacketsManager.ProcessBytes(_session, ref dcode);
                     break;
                 }
             default:
                 {
                     break;
                 }
         }
     }
     catch (Exception Ex)
     { 
         LogConsole.Show(LogType.ERROR, "{0}", Ex.ToString());
     }
 }
开发者ID:JoaquinVautier,项目名称:DragonBound,代码行数:25,代码来源:Server.cs


示例8: OnMessage

 protected override void OnMessage(MessageEventArgs e)
 {
     WSGroupServices.GetLogger().Info("Message received");
     try
     {
         var message = spp.Parse(e.Data);
         if (message is Pull)
         {
             PullHandler();
         }
         else if (message is Push)
         {
             PushHandler((Push)message);
         }
         else if (message is Register)
         {
             RegisterHandler((Register)message);
         }
         else { WSGroupServices.GetLogger().Error("Unhandled message type"); }
     }
     catch (ServerProtocolParsingError)
     {
         WSGroupServices.GetLogger().Error("Message parsing error:\n" + e.Data.Substring(0, 200));
     }
 }
开发者ID:kevoree,项目名称:kevoree-dotnet-group-ws,代码行数:25,代码来源:WSGroupServerWSService.cs


示例9: OnRecievedMessage

        private void OnRecievedMessage(object sender, MessageEventArgs message)
        {
            var result = BuildResult.Parse(message.Data);
            var msg = result.ToMessage();

            if (result.IsFailure)
            {
                ShowBalloon(ToolTipIcon.Info, msg);
                PlaySound(result);
                return;
            }

            if (Settings.Default.ShowErrorOnly)
            {
                return;
            }

            if (result.IsSuccess)
            {
                ShowBalloon(ToolTipIcon.Info, msg);
                PlaySound(result);
            }
            else if (result.IsUnstable)
            {
                ShowBalloon(ToolTipIcon.Warning, msg);
                PlaySound(result);
            }
            else if (result.IsAborted)
            {
                ShowBalloon(ToolTipIcon.Info, msg);
                PlaySound(result);
            }
        }
开发者ID:jz5,项目名称:Pronama-chan-WebSocketNotifierClient,代码行数:33,代码来源:MainForm.cs


示例10: OnMessage

        protected override void OnMessage(MessageEventArgs e)
        {
            string msg = string.Empty;
            string logMsg = string.Empty;

            // grab first part of request
            // everything before the first _ denotes what method should be called... maybe not very clean...
            List<string> parameters = e.Data.Split('_').ToList();
            string requestType = parameters[0];
            // we've already gotten the requestType, now remove it, so we don't have to work around it
            parameters.RemoveAt(0);

            switch (requestType)
            {
                case "getMatchHistory":
                    Console.WriteLine("Received match history request for: " + parameters[0]);
                    msg = GetMatchHistory(parameters[0]);
                    logMsg = "Sent match history response.";
                    break;

                default:
                    Console.WriteLine("An unknown request was made.");
                    break;
            }

            Send(msg);
            Console.WriteLine(logMsg);
        }
开发者ID:Flascher,项目名称:dota-mango-server,代码行数:28,代码来源:MangoMatchService.cs


示例11: OnMessage

 protected override void OnMessage(MessageEventArgs e) {
   string[] sa;
   if(e.Type==Opcode.Text && !string.IsNullOrEmpty(e.Data) && (sa=e.Data.Split('\t'))!=null && sa.Length>0) {
     if(_verbose.value) {
       X13.Log.Debug("ws.msg({0})", string.Join(", ", sa));
     }
     if(sa[0]=="C" && sa.Length==3) {  // Connect, username, password
       if((sa[1]!="local" || _ses.ip.IsLocal()) && MQTT.MqBroker.CheckAuth(sa[1], sa[2])) {
         _ses.userName=sa[1];
         Send("C\ttrue");
         if(_verbose.value) {
           X13.Log.Info("{0} logon as {1} success", _ses.owner.name, _ses.ToString());
         }
       } else {
         Send("C\tfalse");
         if(_verbose.value) {
           X13.Log.Warning("{0}@{2} logon  as {1} failed", _ses.owner.name, sa[1], _ses.owner.value);
         }
         Sessions.CloseSession(base.ID);
       }
     } else if(!_disAnonym.value || (_ses!=null && !string.IsNullOrEmpty(_ses.userName))) {
       if(sa[0]=="P" && sa.Length==3) {
         HttpWsPl.ProcessPublish(sa[1], sa[2], _ses);
       } else if(sa[0]=="S" && sa.Length==2) {
         _subscriptions.Add(Topic.root.Subscribe(sa[1], SubChanged));
       }
     }
   }
 }
开发者ID:giapdangle,项目名称:X13.Host,代码行数:29,代码来源:ApiV03.cs


示例12: OnMessage

        protected override void OnMessage(MessageEventArgs e)
        {
            log.Info("Received message: " + e.Data);

            if (string.IsNullOrEmpty(e.Data))
                return;

            var msg = JsonConvert.DeserializeObject<Message>(e.Data);

            if (msg == null || string.IsNullOrEmpty(msg.Path) || _servicesDict[msg.Path] == null)
                return;

            var session = Bootstrapper.CreateSession();
            using (var transaction = session.BeginTransaction()) {
                bool commitTransaction = true;

                _servicesDict[msg.Path].HandleMessage(session, e.Data, (string message) => {
                    log.Info("Sending message: " + message);
                    Send(message);
                }, ref commitTransaction);

                if (commitTransaction)
                    transaction.Commit();
                else
                    transaction.Rollback();
            }
        }
开发者ID:skralg,项目名称:IdleLandsRedux,代码行数:27,代码来源:IdleLandsMainService.cs


示例13: OnMessage

 private void OnMessage(object sender, MessageEventArgs e)
 {
     IService service = e.CallerContext as IService;
     service.ServiceManager.Get<ISemanticProcessor>().ProcessInstance<SocketMembrane, ClientSocketMessage>(msg =>
         {
             msg.Text = e.Data;
         });
 }
开发者ID:cliftonm,项目名称:clifton,代码行数:8,代码来源:WebSocketClientService.cs


示例14: OnMessageAdv

 private void OnMessageAdv(object sender, MessageEventArgs e)
 {
     JObject body = JObject.Parse(e.Data);
     if (body["msg"] == null)
         return;
     string msg = body["msg"].ToObject<string>();
     DdpMessage?.Invoke(this, new DdpMessage(msg, e.Data));
 }
开发者ID:rickard-505,项目名称:DDPClient-NET,代码行数:8,代码来源:DdpWebSocket.cs


示例15: OnSocketMessage

 private void OnSocketMessage(object sender, MessageEventArgs e)
 {
     dynamic message = JsonConvert.DeserializeObject(e.Data);
     if (message.type == "message")
     {
         Log.Write("Recieved message: " + e.Data);
         _rtmIncomingMessages.OnMessage(message);
     }
 }
开发者ID:seanhussey,项目名称:windows-slack-notifier,代码行数:9,代码来源:RtmConnection.cs


示例16: OnMessageInternal

        void OnMessageInternal(object sender, MessageEventArgs e)
        {
            Debug.Assert(e.Type == Opcode.Text);

            if (OnMessage != null)
            {
                OnMessage(this, UTF8Encoding.UTF8.GetString(e.RawData));
            }
        }
开发者ID:wildbunny,项目名称:c-graphene-api,代码行数:9,代码来源:GrapheneWebsocket.cs


示例17: OnMessage

 protected override void OnMessage(MessageEventArgs e)
 {
     IService service = e.CallerContext as IService;
     service.ServiceManager.Get<ISemanticProcessor>().ProcessInstance<SocketMembrane, ServerSocketMessage>(msg =>
         {
             msg.Text = e.Data;
             msg.Session = this;
         });
 }
开发者ID:cliftonm,项目名称:clifton,代码行数:9,代码来源:WebSocketServerService.cs


示例18: OnMessage

        protected override void OnMessage(MessageEventArgs e)
        {
            var name = Context.QueryString ["name"];
              var msg = !name.IsNullOrEmpty ()
                ? String.Format ("'{0}' to {1}", e.Data, name)
                : e.Data;

              Send (msg);
        }
开发者ID:hdczsf,项目名称:websocket-sharp,代码行数:9,代码来源:Echo.cs


示例19: OnMessage

        protected override void OnMessage(MessageEventArgs e)
        {
            Console.WriteLine("Message received: " + e.Data);
            var msg = e.Data == "HELLO"
                      ? "Nya"
                      : "Pff";

            Send(msg);
        }
开发者ID:megaton,项目名称:catsim-server,代码行数:9,代码来源:Program.cs


示例20: OnMessage

        protected override void OnMessage(MessageEventArgs e)
        {
            var name = Context.QueryString ["name"];
              var msg = name != null
              ? String.Format ("Returns '{0}' to {1}", e.Data, name)
              : e.Data;

              Send (msg);
        }
开发者ID:kevleyski,项目名称:websocket-sharp,代码行数:9,代码来源:Echo.cs



注:本文中的WebSocketSharp.MessageEventArgs类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# WebSocketSharp.WebSocket类代码示例发布时间:2022-05-26
下一篇:
C# WebSocketSharp.CloseEventArgs类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap