/// <summary> /// Initializes our client /// </summary> private void InitializeClient() { var ortc = new Ibt.Ortc.Mobile.Api.Ortc(); var factory = ortc.LoadOrtcFactory("IbtRealTimeSJ"); client = factory.CreateClient(); // Sets the actions for the various handlers // OnConnected client.OnConnected += (s) => { txtConnStatus.Text = String.Format("Connected to {0}", ((IOrtcClient)s).Url); // Sets the connection status SubscribeChannel(); // Subscribes us to the ORTC channel }; // OnDisconnected client.OnDisconnected += (s) => { txtConnStatus.Text = String.Format("Disconnected"); // Sets the connection status }; // OnException client.OnException += (s, error) => { txbLog.Text += String.Format("Error: {0}{1}", error.Message, Environment.NewLine); // Log }; // OnReconnecting client.OnReconnecting += (s) => { txtConnStatus.Text = String.Format("Disconnected"); // Sets the connection status txbLog.Text = String.Format("Reconnecting"); // Log }; client.OnReconnected += (s) => { txtConnStatus.Text = String.Format("Reconnected to {0}", ((IOrtcClient)s).Url); // Sets the connection status }; client.OnSubscribed += (s, channel) => { txbLog.Text += String.Format("Channel {0} subscribed.{1}", channel, Environment.NewLine); // Log }; client.OnUnsubscribed += (s, channel) => { txbLog.Text += String.Format("Channel {0} unsubscribed.{1}", channel, Environment.NewLine); // Log }; }
private void InitializeClient() { var ortc = new Ibt.Ortc.Mobile.Api.Ortc(); var factory = ortc.LoadOrtcFactory("IbtRealTimeSJ"); client = factory.CreateClient(); client.OnConnected += (s) => { textBlockConnectionStatus.Text = String.Format("Connected to {0}", ((IOrtcClient)s).Url); }; client.OnDisconnected += (s) => { textBlockConnectionStatus.Text = String.Format("Disconnected"); }; client.OnException += (s, error) => { textBlockLog.Text += String.Format("Error: {0}{1}", error.Message, Environment.NewLine); }; client.OnReconnecting += (s) => { textBlockConnectionStatus.Text = String.Format("Disconnected"); textBlockLog.Text = String.Format("Reconnecting"); }; client.OnReconnected += (s) => { textBlockConnectionStatus.Text = String.Format("Reconnected to {0}", ((IOrtcClient)s).Url); }; client.OnSubscribed += (s, channel) => { textBlockLog.Text += String.Format("Channel {0} subscribed.{1}", channel, Environment.NewLine); }; client.OnUnsubscribed += (s, channel) => { textBlockLog.Text += String.Format("Channel {0} unsubscribed.{1}", channel, Environment.NewLine); }; }
private void InitializeClient() { var ortc = new Ibt.Ortc.Mobile.Api.Ortc(); var factory = ortc.LoadOrtcFactory("IbtRealTimeSJ"); if (factory != null) { _ortcClient = factory.CreateClient(); _ortcClient.OnConnected += (s) => { IOrtcClient ortcClient = (IOrtcClient)s; Log(String.Format("Connected to: {0}", ortcClient.Url)); Log(String.Format("Connection metadata: {0}", ortcClient.ConnectionMetadata)); Log(String.Format("Session ID: {0}", ortcClient.SessionId)); }; _ortcClient.OnDisconnected += (s) => { Log("Disconnected"); }; _ortcClient.OnException += (s, error) => { Log(String.Format("Error: {0}", error.Message)); }; _ortcClient.OnReconnecting += (s) => { IOrtcClient ortcClient = (IOrtcClient)s; // Update URL with user entered text if ((bool)chkConnectionIsCluster.IsChecked) { Log(String.Format("Reconnecting to: {0}", ortcClient.ClusterUrl)); } else { Log(String.Format("Reconnecting to: {0}", ortcClient.Url)); } }; _ortcClient.OnReconnected += (s) => { IOrtcClient ortcClient = (IOrtcClient)s; Log(String.Format("Reconnected to {0}", ortcClient.Url)); }; _ortcClient.OnSubscribed += (s, channel) => { Log(String.Format("Subscribed to: {0}", channel)); }; _ortcClient.OnUnsubscribed += (s, channel) => { Log(String.Format("Unsubscribed from: {0}", channel)); }; } else { Log("Factory is null"); } }