public GcmXmppConnection (GcmXmppConfiguration configuration) { authCompletion = new TaskCompletionSource<bool> (); notifications = new Dictionary<string,CompletableNotification> (); Configuration = configuration; certificates = new X509CertificateCollection (); // Add local/machine certificate stores to our collection if requested //if (Configuration.AddLocalAndMachineCertificateStores) { var store = new X509Store (StoreLocation.LocalMachine); certificates.AddRange (store.Certificates); store = new X509Store (StoreLocation.CurrentUser); certificates.AddRange (store.Certificates); //} // Add optionally specified additional certs into our collection // if (Configuration.AdditionalCertificates != null) { // foreach (var addlCert in Configuration.AdditionalCertificates) // certificates.Add (addlCert); // } // Finally, add the main private cert for authenticating to our collection // if (certificate != null) // certificates.Add (certificate); }
public async Task GCMXMPP_Connect () { var succeeded = 0; var failed = 0; var attempted = 0; var c = new GcmXmppConfiguration { Production = false, AuthenticationToken = Settings.Instance.GcmAuthToken, SenderIDs = new List<string> { Settings.Instance.GcmSenderId } }; var gcm = new GcmXmppConnection (c); await gcm.Connect (); foreach (var regId in Settings.Instance.GcmRegistrationIds) { gcm.Send (new GcmXmppConnection.CompletableNotification (new GcmXmppNotification { To = regId, Data = JObject.Parse ("{ \"somekey\" : \"somevalue\" }") })); } gcm.Close (); Assert.AreEqual (attempted, succeeded); Assert.AreEqual (0, failed); }
public GcmXmppConnection(GcmXmppConfiguration configuration) { authCompletion = new TaskCompletionSource <bool> (); notifications = new Dictionary <string, CompletableNotification> (); Configuration = configuration; certificates = new X509CertificateCollection(); // Add local/machine certificate stores to our collection if requested //if (Configuration.AddLocalAndMachineCertificateStores) { var store = new X509Store(StoreLocation.LocalMachine); certificates.AddRange(store.Certificates); store = new X509Store(StoreLocation.CurrentUser); certificates.AddRange(store.Certificates); //} // Add optionally specified additional certs into our collection // if (Configuration.AdditionalCertificates != null) { // foreach (var addlCert in Configuration.AdditionalCertificates) // certificates.Add (addlCert); // } // Finally, add the main private cert for authenticating to our collection // if (certificate != null) // certificates.Add (certificate); }
public GcmXmppServiceConnectionFactory(GcmXmppConfiguration configuration) { Configuration = configuration; }
public GcmXmppServiceConnection(GcmXmppConfiguration configuration) { connection = new GcmXmppConnection(configuration); }
public GcmXmppServiceBroker(GcmXmppConfiguration configuration) : base(new GcmXmppServiceConnectionFactory(configuration)) { }