/// <summary> /// Invoked when this page is about to be displayed in a Frame. /// </summary> /// <param name="e">Event data that describes how this page was reached. /// This parameter is typically used to configure the page.</param> protected async override void OnNavigatedTo(NavigationEventArgs e) { r1.channel = SharedInformation.savedRoom.name; r1.token = SharedInformation.savedRoom.password; ortcClient = new RealtimeFramework.Messaging.OrtcClient(); ortcExample = new OrtcExample(); //r1 = IsolatedStorageHelper.GetObject<Room>("100"); ortcExample.Channel = r1.channel; ortcExample.AuthenticationToken = r1.token; if (ortcExample.Channel.Equals(r1.channel)) { message.DataContext = ortcExample; //ConsoleGrid.DataContext = ortcExample; ortcExample.DoConnectDisconnect(); } await Task.Delay(TimeSpan.FromSeconds(3)); ortcExample.DoSendMessage(SharedInformation.myNumber + SharedInformation.myColor.ToLower() + "/" + SharedInformation.myName); await Task.Delay(TimeSpan.FromSeconds(3)); //ortcExample.DoClearLog(); //await Getroominfo(); await Windows.UI.ViewManagement.StatusBar.GetForCurrentView().HideAsync(); }
public CameraPage() { InitializeComponent(); try { gameUpdate.Text = SharedInformation.myNumber; } catch { gameUpdate.Text += "erreur 0"; } try { nbrLiving = SharedInformation.ListOfPlayers.Count; gameUpdate.Text += nbrLiving; } catch { gameUpdate.Text += "erreur counting"; } timing(); message.Focus(FocusState.Keyboard); _navigationHelper = new NavigationHelper(this); controlBar.HideButtonClicked += OnHideButtonClicked; controlBar.ToggleFlashButtonClicked += OnToggleFlashButtonClicked; controlBar.SettingsButtonClicked += OnSettingsButtonClicked; this.Loaded += BasicPage_Loaded; this.LayoutUpdated += BasicPage_LayoutUpdated; _videoEngine = VideoEngine.Instance; _settings = App.Settings; NavigationCacheMode = NavigationCacheMode.Required; ortcClient = new RealtimeFramework.Messaging.OrtcClient(); ortcExample = new OrtcExample(); ortcExample.Channel = SharedInformation.savedRoom.name; ortcExample.AuthenticationToken = SharedInformation.savedRoom.password; if (ortcExample.Channel.Equals(SharedInformation.savedRoom.name)) { message.DataContext = ortcExample; ortcExample.DoConnectDisconnect(); } }
public OrtcExample() { ortcClient = new RealtimeFramework.Messaging.OrtcClient(); ApplicationKey = "YourApplicationKey"; AuthenticationToken = "YourToken"; Url = "https://ortc-developers.realtime.co/server/ssl/2.1";// "http://ortc-prd2-useast1-S0002.realtime.co";// ConnectionMetadata = "Windows 8.1 Example"; Channel = "yellow"; Message = "This is the message."; Log = ""; IsCluster = true; ActionName = "Connect"; PrivateKey = "YourPrivateKey"; IsPrivate = false; Ttl = 1800; PermisionType = "Read"; ortcClient.OnConnected += ortcClient_OnConnected; ortcClient.OnDisconnected += ortcClient_OnDisconnected; ortcClient.OnException += ortcClient_OnException; ortcClient.OnSubscribed += ortcClient_OnSubscribed; ortcClient.OnUnsubscribed += ortcClient_OnUnsubscribed; ortcClient.OnReconnecting += ortcClient_OnReconnecting; ortcClient.OnReconnected += ortcClient_OnReconnected; }
private void LoadFactory() { try { // Construct object _ortc = OrtcClientFactory.CreateClient(); if (_ortc != null) {//_ortc.ConnectionTimeout = 10000; // Handlers _ortc.OnConnected += ortc_OnConnected; _ortc.OnDisconnected += ortc_OnDisconnected; _ortc.OnReconnecting += ortc_OnReconnecting; _ortc.OnReconnected += ortc_OnReconnected; _ortc.OnSubscribed += ortc_OnSubscribed; _ortc.OnUnsubscribed += ortc_OnUnsubscribed; _ortc.OnException += ortc_OnException; } } catch (Exception ex) { Log(ex.Message); } if (_ortc == null) { Terminal.LogError("ORTC object is null"); } }
public OrtcExample() { ortcClient = new RealtimeFramework.Messaging.OrtcClient(); ApplicationKey = "n50G8j"; AuthenticationToken = "1e766fa6dfa34381b6324d3bcafce489"; Url = "http://ortc-developers.realtime.co/server/2.1/";// "http://ortc-prd2-useast1-S0002.realtime.co";// ConnectionMetadata = "Windows 8.1 Example"; Channel = "yellow"; Log = ""; IsCluster = true; ActionName = "Connect"; PrivateKey = "R5HR2mCnSOKz"; IsPrivate = false; Ttl = 1800; PermisionType = "Read"; ortcClient.OnConnected += ortcClient_OnConnected; ortcClient.OnDisconnected += ortcClient_OnDisconnected; ortcClient.OnException += ortcClient_OnException; ortcClient.OnSubscribed += ortcClient_OnSubscribed; ortcClient.OnUnsubscribed += ortcClient_OnUnsubscribed; ortcClient.OnReconnecting += ortcClient_OnReconnecting; ortcClient.OnReconnected += ortcClient_OnReconnected; }
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"); }
private void InitializeMessaging() { client = new OrtcClient(); client.ClusterUrl = "http://ortc-developers.realtime.co/server/2.1"; client.OnConnected += ortc_OnConnected; client.OnDisconnected += ortc_OnDiconnected; client.OnSubscribed += ortc_OnSubscribed; client.OnException += ortc_OnException; client.ConnectionMetadata = "Xamarin-" + new Random().Next(1000); client.HeartbeatTime = 2; Connect(); }
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()); }
/// <summary> /// Constructs a new messenger /// </summary> /// <param name="uri"></param> /// <param name="appKey"></param> public StorageMessenger(UriPrototype uri, string appKey) { AppKey = appKey; Client = new UnityOrtcClient(); Client.OnConnected += OnConnected; Client.OnSubscribed += OnSubscribed; Client.OnException += OnException; if (uri.IsCluster) { Url = uri.IsSecure ? "https://" + uri.Url + "/server/ssl/2.1" : "http://" + uri.Url + "/server/2.1"; Client.ClusterUrl = Url; } else { Url = uri.IsSecure ? "https://" + uri.Url : "http://" + uri.Url; Client.Url = Url; } }
/// <summary> /// Loads the ORTC factory /// </summary> /// <returns></returns> private bool ORTCLoadFactory() { try { // Load factory var api = new Ibt.Ortc.Api.Ortc("Plugins"); IOrtcFactory factory = api.LoadOrtcFactory("IbtRealTimeSJ"); if (factory != null) { // Construct object ortcClient = factory.CreateClient(); if (ortcClient != null) { ortcClient.Id = "RTCH"; // Handlers ortcClient.OnConnected += new OnConnectedDelegate(ortc_OnConnected); ortcClient.OnDisconnected += new OnDisconnectedDelegate(ortc_OnDisconnected); ortcClient.OnException += (sender, error) => { Log(error.ToString()); }; return(true); } } else { Log("Factory is null"); } } catch (Exception ex) { Log(ex.Message); } if (ortcClient == null) { Log("ORTC object is null"); } return(false); }
private void LoadFactory() { try { // Load factory var api = new Api.Ortc("Plugins"); IOrtcFactory factory = api.LoadOrtcFactory("IbtRealTimeSJ"); if (factory != null) { // Construct object _ortc = factory.CreateClient(); if (_ortc != null) { _ortc.Id = "dot_net_client"; //_ortc.ConnectionTimeout = 10000; // Handlers _ortc.OnConnected += new OnConnectedDelegate(ortc_OnConnected); _ortc.OnDisconnected += new OnDisconnectedDelegate(ortc_OnDisconnected); _ortc.OnReconnecting += new OnReconnectingDelegate(ortc_OnReconnecting); _ortc.OnReconnected += new OnReconnectedDelegate(ortc_OnReconnected); _ortc.OnSubscribed += new OnSubscribedDelegate(ortc_OnSubscribed); _ortc.OnUnsubscribed += new OnUnsubscribedDelegate(ortc_OnUnsubscribed); _ortc.OnException += new OnExceptionDelegate(ortc_OnException); } } else { Log("Factory is null"); } } catch (Exception ex) { Log(ex.Message); } if (_ortc == null) { Log("ORTC object is null"); } }
/// <summary> /// Constructs a new messenger /// </summary> /// <param name="uri"></param> /// <param name="appKey"></param> public StorageMessenger(UriPrototype uri, string appKey) { AppKey = appKey; Client = new UnityOrtcClient(); Client.OnConnected += OnConnected; Client.OnSubscribed += OnSubscribed; Client.OnException += OnException; if (uri.IsCluster) { Url = uri.IsSecure ? "https://" + uri.Url + "/server/ssl/2.1" : "http://" + uri.Url + "/server/2.1"; Client.ClusterUrl = Url; } else { Url = uri.IsSecure ? "https://" + uri.Url : "http://" + uri.Url; Client.Url = Url; } }
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; } }
private void factory_start() { try { api = new Ortc(); IOrtcFactory fact = api.LoadOrtcFactory("test"); if (fact != null) { _ortc = fact.CreateClient(); if (_ortc != null) { _ortc.Id = "dot_net_client"; // set OrtcCLient properties here if you wish _ortc.OnConnected += new OnConnectedDelegate(ortc_OnConnected); _ortc.OnDisconnected += new OnDisconnectedDelegate(ortc_OnDisconnected); _ortc.OnReconnecting += new OnReconnectingDelegate(ortc_OnReconnecting); _ortc.OnReconnected += new OnReconnectedDelegate(ortc_OnReconnected); _ortc.OnSubscribed += new OnSubscribedDelegate(ortc_OnSubscribed); _ortc.OnUnsubscribed += new OnUnsubscribedDelegate(ortc_OnUnsubscribed); _ortc.OnException += new OnExceptionDelegate(ortc_OnException); Console.WriteLine("Factory_start succesfull"); } } else { Console.WriteLine("Failure for fact"); } } catch { Console.WriteLine("Error"); } if (_ortc == null) { Console.WriteLine("Null ortc"); // cw TAB -- console write } }
public MainView() { client = new OrtcClient(); client.ClusterUrl = ClusterUrlSSL; client.ConnectionMetadata = "Xamarin-" + new Random().Next(1000); client.HeartbeatTime = 2; //client.GoogleProjectNumber = GoogleProjectNumber; client.OnConnected += client_OnConnected; client.OnDisconnected += client_OnDisconnected; client.OnException += client_OnException; client.OnReconnected += client_OnReconnected; client.OnReconnecting += client_OnReconnecting; client.OnSubscribed += client_OnSubscribed; client.OnUnsubscribed += client_OnUnsubscribed; //client.SetOnPushNotification(client_OnPushNotification); Channel = "myChannel"; Message = client.ConnectionMetadata; BindingContext = this; InitializeComponent(); }
private void LoadFactory() { try { // Construct object _ortc = OrtcClientFactory.CreateClient(); if (_ortc != null) {//_ortc.ConnectionTimeout = 10000; // Handlers _ortc.OnConnected += ortc_OnConnected; _ortc.OnDisconnected += ortc_OnDisconnected; _ortc.OnReconnecting += ortc_OnReconnecting; _ortc.OnReconnected += ortc_OnReconnected; _ortc.OnSubscribed += ortc_OnSubscribed; _ortc.OnUnsubscribed += ortc_OnUnsubscribed; _ortc.OnException += ortc_OnException; } } catch (Exception ex) { Log(ex.Message); } if (_ortc == null) { Terminal.LogError("ORTC object is null"); } }
/// <summary> /// Creates a new messenger with the default url /// </summary> public RealtimeMessenger(OrtcClient client, MessengerSettings settings) { TaskManager.ConfirmInit(); _client = client; _client.OnConnected += _client_OnConnected; _client.OnDisconnected += _client_OnDisconnected; _client.OnReconnected += _client_OnReconnected; _client.OnReconnecting += _client_OnReconnecting; _client.OnException += _client_OnException; _client.OnSubscribed += _client_OnSubscribed; _client.OnUnsubscribed += _client_OnUnsubscribed; ApplicationKey = settings.ApplicationKey; PrivateKey = settings.PrivateKey; Url = new RealtimeUrl(settings.Url, settings.IsCluster); AuthenticationTime = settings.AuthenticationTime; AuthenticationIsPrivate = settings.AuthenticationIsPrivate; }