Exemplo n.º 1
0
        public override void connect()
        {
            base.connect();
            //Starts event handler for this client/session.
            start_event_handler();
            try
            {
                connect_response = (CommandResponse)ProtocolSend("connect");
                if (!connect_response.IsSuccess())
                {
                    throw new ConnectError("Error Connecting");
                }
            }
            catch (Exception ex)
            {
                throw new ConnectError("Timeout Connecting");
            }
            // Sets channel and channel unique id from this event
            _channel = connect_response;
            _uuid = connect_response.GetHeader("Unique-ID");

            //Set connected flag to True
            connected = true;

            // Sets event filter or raises ConnectError
            CommandResponse filter_response;
            if (_is_eventjson)
            {
                filter_response = (CommandResponse)EventJson(_filter);
            }
            else
            {

                filter_response = (CommandResponse)EventPlain(_filter);
            }
            if (!filter_response.IsSuccess())
            {
                throw new ConnectError("Event filter failure");
            }
        }
Exemplo n.º 2
0
        public static CommandResponse Cast(Event evnt)
        {
            CommandResponse cls = new CommandResponse("");

                cls._headers = evnt._headers;
                cls._raw_body = evnt._raw_body;
            return cls;
        }