public static void AddRpcHandler(GmRpcNameEnum gmRpcName, OnReceiveMsgInvoker handler)
 {
     if (rpcHandlerDict.ContainsKey(gmRpcName))
     {
         rpcHandlerDict[gmRpcName] = handler;
     }
     else
     {
         rpcHandlerDict.Add(gmRpcName, handler);
     }
 }
        public static void SendMessage(GmRpcNameEnum gmRpcName, byte[] protoData, OnReceiveMsgInvoker handler)
        {
            if (handler != null)
            {
                AddRpcHandler(gmRpcName, handler);
            }

            int totalLength = protoData.Length + 12;
            int rpcNum      = (int)gmRpcName;
            int errorCode   = (int)GmRpcErrorCodeEnum.GmRpcOk;

            byte[] sendByteArray = new byte[totalLength];
            IntEncodingUtil.IntToByteArrayByBigEndian(totalLength).CopyTo(sendByteArray, 0);
            IntEncodingUtil.IntToByteArrayByBigEndian(rpcNum).CopyTo(sendByteArray, 4);
            IntEncodingUtil.IntToByteArrayByBigEndian(errorCode).CopyTo(sendByteArray, 8);
            protoData.CopyTo(sendByteArray, 12);

            ws.Send(sendByteArray);
        }