Пример #1
0
        protected bool sendConnect()
        {
            LogHelper.Log($"BayeauxClient: sendConnect()...");

            BayeuxClientState bayeuxClientState = this.bayeuxClientState;

            if (isHandshook(bayeuxClientState))
            {
                IMutableMessage message = newMessage();
                message.Channel = Channel_Fields.META_CONNECT;
                message[Message_Fields.CONNECTION_TYPE_FIELD] = bayeuxClientState.transport.Name;
                if (bayeuxClientState.type == State.CONNECTING || bayeuxClientState.type == State.UNCONNECTED)
                {
                    // First connect after handshake or after failure, add advice
                    message.getAdvice(true)["timeout"] = 0;
                }
                bayeuxClientState.send(connectListener, message);
                LogHelper.Log($"BayeauxClient: sendConnect() returning true.");
                return(true);
            }

            LogHelper.Log($"BayeauxClient: sendConnect() returning false.");

            return(false);
        }