Ejemplo n.º 1
0
        iMsg Data_Command(object sender, cMsg Args)
        {
            iMsg             sReturn    = null;
            WebsocketHandler Connection = (WebsocketHandler)sender;

            if (Received == null)
            {
                return(null);
            }
            if (Connection == null)
            {
                return(null);
            }

            try
            {
                sReturn = Received(Connection, Connection.Peer, Args);
            }
            catch (Exception ex)
            {
                string sLine = "Server.Err: " + ex.Message;

                Write(sLine);

                sReturn = new sMsg("error", sLine);
            }

            return(sReturn);
        }
Ejemplo n.º 2
0
        private void Data_Command(object sender, cMsg Args)
        {
            iMsg             sReturn    = null;
            WebsocketHandler Connection = (WebsocketHandler)sender;

            if (Command == null)
            {
                return;
            }
            if (Connection == null)
            {
                return;
            }

            try
            {
                sReturn = Command(Connection, Args);
            }
            catch (Exception ex)
            {
                sReturn = new sMsg("error", ex.Message);
            }

            if (Connection != null)
            {
                Connection.Send(sReturn);
            }
        }