Exemplo n.º 1
0
        /// <summary>
        /// 处理接收信息
        /// </summary>
        /// <param name="client"></param>
        /// <param name="message"></param>
        private void receiveMessage(IWebSocketConnection client, string message)
        {
            WSProtocol wsp = default;

            this.LogModule.Debug($"接收到网络命令:{client.ConnectionInfo.ClientIpAddress}  内容:{message}");
            try
            {
                wsp = WSProtocol.FromJson(message);
            }
            catch (Exception ex)
            {
                this.LogModule.Error($"接收到无法解析的内容: {message}");
                return;
            }
            if (wsp == null || wsp?.Header == null || wsp?.Body == null)
            {
                this.LogModule.Error($"接收到无法解析的内容: {message}");
                return;
            }

            switch (wsp.Header.Ver)
            {
            case "1.0":    //
            default:
                this.procWSPDefault(wsp);
                break;
            }
        }