Пример #1
0
        public static IGXWebSocketAsync GetWebSocketProvider()
        {
            IGXWebSocketAsync ws = null;

            try
            {
#if NETCORE
                ws = new WSHandler();
#else
                Type t = Type.GetType("GeneXus.Http.WebSocket.WSHandler,gxwebsocket");
                ws = (IGXWebSocketAsync)Activator.CreateInstance(t);
#endif
                GXLogging.Debug(log, "ASP.NET Websocket instance created ok");
            }
            catch (Exception e)
            {
                GXLogging.Error(log, "Could not initialize ASP.NET WebSocket ", e);
            }
            return(ws);
        }
Пример #2
0
        public bool Init()
        {
            bool started = false;

            if (_ws == null)
            {
                lock (syncObj)
                {
                    if (_ws == null)
                    {
                        _ws = GXWebSocketFactory.GetWebSocketProvider();
                        if (_ws != null)
                        {
                            started = _ws.Start();
                        }
                        else
                        {
                            started = false;
                        }
                    }
                }
            }
            else
            {
                started = true;
            }
            if (!started)
            {
                SetError(1);
            }
            else
            {
                SetError(0);
            }
            return(started);
        }