コード例 #1
0
ファイル: WSHandler.cs プロジェクト: jechague/DotNetClasses
        public override void OnMessage(string message)
        {
            string     key     = GetClientKey(this);
            Type       objType = GeneXus.Metadata.ClassLoader.FindType("GeneXus", GX_NOTIFICATIONINFO_NAME, null);
            GxUserType nInfo   = (GxUserType)Activator.CreateInstance(objType);
            JObject    jObj    = new JObject();

            jObj.Put("Message", message);
            nInfo.FromJSONObject(jObj);
            ExecuteHandler(HandlerType.ReceivedMessage, new Object[] { key, nInfo });
            OnNewMessage?.Invoke(key, message);
        }
コード例 #2
0
ファイル: WSHandler.cs プロジェクト: jechague/DotNetClasses
        public override Task OnMessage(string connectionGUID, System.Net.WebSockets.WebSocket socket, WebSocketReceiveResult result, byte[] buffer)
        {
            string     key     = connectionGUID;
            string     message = Encoding.UTF8.GetString(buffer);
            Type       objType = GeneXus.Metadata.ClassLoader.FindType("GeneXus", GX_NOTIFICATIONINFO_NAME, null);
            GxUserType nInfo   = (GxUserType)Activator.CreateInstance(objType);
            JObject    jObj    = new JObject();

            jObj.Put("Message", message);
            nInfo.FromJSONObject(jObj);
            ExecuteHandler(HandlerType.ReceivedMessage, new Object[] { key, nInfo });
            OnNewMessage?.Invoke(key, message);
            return(Task.CompletedTask);
        }