public void DoConnect(object s, EventArgs e)
        {
            Watch.Reset();
            Watch.Start();
            Log("Connecting...");
            client.ClusterUrl = ClusterUrl;

            if (!client.IsConnected)
            {
                State = ConnectionState.Connecting;
            }
            client.Connect(AppKey, Guid.NewGuid().ToString());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Connects to the ORTC server
        /// </summary>
        /// <returns></returns>
        private bool ConnectToORTC()
        {
            Log(String.Format("Connecting to: {0} ", ORTC_SERVER_URL));

            ortcClient.ClusterUrl = ORTC_SERVER_URL;
            ortcClient.Connect(txtORTCAppKey.Text, txtORTCAuthToken.Text);

            return(true);
        }
Ejemplo n.º 3
0
        public MainPage()
        {
            this.InitializeComponent();

            // Establish the Realtime connection
            ortcClient              = new RealtimeFramework.Messaging.OrtcClient();
            ortcClient.OnConnected += OnConnected;
            ortcClient.OnException += OnException;

            ortcClient.ClusterUrl = "http://ortc-developers.realtime.co/server/2.1/";
            Log("Connecting to a Realtime server ...");
            ortcClient.Connect("2Ze1dz", "token");
        }
Ejemplo n.º 4
0
 public void DoConnectDisconnect(object sender, RoutedEventArgs e)
 {
     if (ortcClient.IsConnected)
     {
         ortcClient.Disconnect();
         WriteLog("Disconnecting...");
     }
     else
     {
         ortcClient.ConnectionMetadata = ConnectionMetadata;
         if (IsCluster)
         {
             ortcClient.ClusterUrl = Url;
         }
         else
         {
             ortcClient.Url = Url;
         }
         ortcClient.Connect(ApplicationKey, AuthenticationToken);
         WriteLog("Connecting...");
     }
 }
Ejemplo n.º 5
0
        public MessageManager()
        {
            ortcClient            = new OrtcClient();
            ortcClient.ClusterUrl = "http://ortc-developers.realtime.co/server/2.1/";

            // Ortc client handlers
            ortcClient.OnConnected  += (object sender) => {
            };
            ortcClient.OnSubscribed += (object sender, string channel) => {
            };
            ortcClient.OnException  += (object sender, Exception ex) => {
            };

            ortcClient.Connect(AppKey, Guid.NewGuid().ToString());
        }
Ejemplo n.º 6
0
        private void btnConnect_Click(object sender, EventArgs e)
        {
            // Update URL with user entered text
            if (chkClientIsCluster.Checked)
            {
                _ortc.ClusterUrl = txtClientUrl.Text;
            }
            else
            {
                _ortc.Url = txtClientUrl.Text;
            }

            Log(String.Format("Connecting to: {0}...", txtClientUrl.Text));

            _ortc.ConnectionMetadata     = txtClientConnectionMetadata.Text;
            _ortc.AnnouncementSubChannel = txtClientAnnouncementSubChannel.Text;

            _ortc.Connect(txtClientAppKey.Text, txtClientToken.Text);
        }
Ejemplo n.º 7
0
        void ConnectToORTC()
        {
            // Establish the Realtime connection
            ortcClient              = new OrtcClient();
            ortcClient.OnConnected += OnConnected;
            ortcClient.OnException += OnException;

            ortcClient.ClusterUrl = "http://ortc-developers.realtime.co/server/2.1/";
            //ortcClient.Connect("2Ze1dz", "token");
            ortcClient.Connect("jXNrX9", "token");
            Message message = new Message();

            message.sentAtDate = DateTime.Now.ToLocalTime().ToString("dd/MM/yyyy");
            if (message.sentAtDate != null)
            {
                TxtChat.Text      = message.sentAtDate;
                TxtSend.IsEnabled = true;
            }
        }
        IEnumerator ConnectAsync(string authToken)
        {
            Client.Connect(AppKey, authToken);

            // Wait for connection
            for (int i = 0; i < 120; i++)
            {
                if (Client.IsConnected)
                {
                    break;
                }

                //Logger.Log("Waiting for Ortc Connect");
                yield return(TaskManager.WaitForSeconds(1));
            }

            if (!Client.IsConnected)
            {
                throw new Exception("Failed to connect");
            }
        }
Ejemplo n.º 9
0
        IEnumerator Connect()
        {
            yield return(1);

            // Update URL with user entered text
            if (ClientIsCluster)
            {
                _ortc.ClusterUrl = ClientURL;
            }
            else
            {
                _ortc.Url = ClientURL;
            }

            _ortc.ConnectionMetadata     = ClientMetaData;
            _ortc.AnnouncementSubChannel = ClientAnnouncmentSubChannel;
            _ortc.HeartbeatActive        = Heartbeat;

            Log(String.Format("Connecting to: {0}...", ClientURL));
            _ortc.Connect(ApplicationKey, AuthToken);
        }
Ejemplo n.º 10
0
 private void connect()
 {
     _ortc.ClusterUrl = " http://ortc-developers.realtime.co/server/2.1";
     _ortc.Connect(Gappkey, Gapptoken);
     Console.WriteLine("Connected");
 }
Ejemplo n.º 11
0
 public void Connect()
 {
     client.Connect(applicationKey, authenticationToken);
 }