public PushServiceBase(TChannelSettings channelSettings, PushServiceSettings serviceSettings) { this.ServiceSettings = serviceSettings ?? new PushServiceSettings(); this.ChannelSettings = channelSettings; this.queuedNotifications = new Queue <Notification>(); /*timerCheckScale = new Timer(new TimerCallback((state) => * { * CheckScale(); * }), null, TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(15));*/ CheckScale(); distributerThread = new Thread(new ThreadStart(Distributer)); //distributerTask = new Task(Distributer, TaskCreationOptions.LongRunning); //distributerTask.ContinueWith((ft) => //{ // var ex = ft.Exception; // }, TaskContinuationOptions.OnlyOnFaulted); // distributerTask.Start(); distributerThread.Start(); IsStopping = false; }
public ApplePushChannel(ApplePushChannelSettings channelSettings, PushServiceSettings serviceSettings = null) : base(channelSettings, serviceSettings) { this.appleSettings = channelSettings; certificate = this.appleSettings.Certificate; certificates = new X509CertificateCollection(); if (appleSettings.AddLocalAndMachineCertificateStores) { var store = new X509Store(StoreLocation.LocalMachine); certificates.AddRange(store.Certificates); store = new X509Store(StoreLocation.CurrentUser); certificates.AddRange(store.Certificates); } certificates.Add(certificate); if (this.appleSettings.AdditionalCertificates != null) foreach (var addlCert in this.appleSettings.AdditionalCertificates) certificates.Add(addlCert); //Start our cleanup task taskCleanup = new Task(() => Cleanup(), TaskCreationOptions.LongRunning); taskCleanup.ContinueWith((t) => { var ex = t.Exception; }, TaskContinuationOptions.OnlyOnFaulted); taskCleanup.Start(); }
public ApplePushService(ApplePushChannelSettings channelSettings, PushServiceSettings serviceSettings = null) : base(new ApplePushChannelFactory(channelSettings), serviceSettings) { var appleChannelSettings = channelSettings; cancelTokenSource = new CancellationTokenSource(); feedbackService = new FeedbackService(); feedbackService.OnFeedbackReceived += this.feedbackService_OnFeedbackReceived; // allow control over feedback call interval, if set to zero, don't make feedback calls automatically if (appleChannelSettings.FeedbackIntervalMinutes > 0) { timerFeedback = new Timer( state => { try { this.feedbackService.Run( channelSettings, this.cancelTokenSource.Token); } catch (Exception ex) { this.Events.RaiseChannelException(ex, PlatformType.Apple); } // Timer will run first after 10 seconds, then every 10 minutes to get feedback! }, null, TimeSpan.FromSeconds(10), TimeSpan.FromMinutes(appleChannelSettings.FeedbackIntervalMinutes)); } }
public AndroidPushChannel(AndroidPushChannelSettings channelSettings, PushServiceSettings serviceSettings = null) : base(channelSettings, serviceSettings) { androidSettings = channelSettings; //Go get the auth token from google try { RefreshGoogleAuthToken(); } catch (GoogleLoginAuthorizationException glaex) { this.Events.RaiseChannelException(glaex); } transport = new C2dmMessageTransportAsync(); transport.UpdateGoogleClientAuthToken += new Action<string>((newToken) => { this.googleAuthToken = newToken; }); transport.MessageResponseReceived += new Action<C2dmMessageTransportResponse>(transport_MessageResponseReceived); transport.UnhandledException += new Action<AndroidNotification, Exception>(transport_UnhandledException); }
public GcmPushChannel(GcmPushChannelSettings channelSettings, PushServiceSettings serviceSettings = null) : base(channelSettings, serviceSettings) { gcmSettings = channelSettings; transport = new GcmMessageTransportAsync(); transport.MessageResponseReceived += new Action<GcmMessageTransportResponse>(transport_MessageResponseReceived); transport.UnhandledException += new Action<GcmNotification, Exception>(transport_UnhandledException); }
public PushServiceBase(ChannelFactory channelFactory, PushServiceSettings serviceSettings = null) { this.channelFactory = channelFactory; this.Events = new ChannelEvents(); this.ServiceSettings = serviceSettings ?? new PushServiceSettings(); this.queuedNotifications = new ConcurrentQueue<Notification>(); ChannelScaler.Start(); this.BeginSending(); }
public ApplePushService(PushChannelSettings channelSettings, PushServiceSettings serviceSettings = null) : base(channelSettings, serviceSettings) { cancelTokenSource = new CancellationTokenSource(); feedbackService = new FeedbackService(); feedbackService.OnFeedbackReceived += new FeedbackService.FeedbackReceivedDelegate(feedbackService_OnFeedbackReceived); timerFeedback = new Timer(new TimerCallback((state) => { feedbackService.Run(channelSettings as ApplePushChannelSettings, this.cancelTokenSource.Token); //Timer will run first after 10 seconds, then every 10 minutes to get feedback! }),null, TimeSpan.FromSeconds(10), TimeSpan.FromMinutes(10)); }
public PushChannelBase(PushChannelSettings channelSettings, PushServiceSettings serviceSettings) { this.stopping = false; //this.CancelTokenSource = new CancellationTokenSource(); //this.CancelToken = CancelTokenSource.Token; this.queuedNotifications = new Queue <Notification>(); this.ChannelSettings = channelSettings; this.ServiceSettings = serviceSettings ?? new PushServiceSettings(); //Start our sending task taskSender = new Thread(new ThreadStart(Sender)); taskSender.Start(); }
public ApplePushChannel(ApplePushChannelSettings channelSettings, PushServiceSettings serviceSettings = null) : base(channelSettings, serviceSettings) { this.appleSettings = channelSettings; certificate = this.appleSettings.Certificate; certificates = new X509CertificateCollection(); certificates.Add(certificate); //Start our cleanup task taskCleanup = new Task(() => Cleanup(), TaskCreationOptions.LongRunning); taskCleanup.ContinueWith((t) => { var ex = t.Exception; }, TaskContinuationOptions.OnlyOnFaulted); taskCleanup.Start(); }
public PushChannelBase(PushChannelSettings channelSettings, PushServiceSettings serviceSettings = null) { this.stopping = false; this.CancelTokenSource = new CancellationTokenSource(); this.CancelToken = CancelTokenSource.Token; this.queuedNotifications = new ConcurrentQueue <Notification>(); this.ChannelSettings = channelSettings; this.ServiceSettings = serviceSettings ?? new PushServiceSettings(); //Start our sending task taskSender = new Task(() => Sender(), TaskCreationOptions.LongRunning); taskSender.ContinueWith((t) => { var ex = t.Exception; }, TaskContinuationOptions.OnlyOnFaulted); taskSender.Start(); }
public PushChannelBase(PushChannelSettings channelSettings, PushServiceSettings serviceSettings = null) { this.stopping = false; this.CancelTokenSource = new CancellationTokenSource(); this.CancelToken = CancelTokenSource.Token; this.queuedNotifications = new ConcurrentQueue<Notification>(); this.ChannelSettings = channelSettings; this.ServiceSettings = serviceSettings ?? new PushServiceSettings(); //Start our sending task taskSender = new Task(() => Sender(), TaskCreationOptions.LongRunning); taskSender.ContinueWith((t) => { var ex = t.Exception; }, TaskContinuationOptions.OnlyOnFaulted); taskSender.Start(); }
public ApplePushChannel(ApplePushChannelSettings channelSettings, PushServiceSettings serviceSettings = null) : base(channelSettings, serviceSettings) { this.appleSettings = channelSettings; //Need to load the private key seperately from apple // Fixed by [email protected] : // The default is UserKeySet, which has caused internal encryption errors, // Because of lack of permissions on most hosting services. // So MachineKeySet should be used instead. certificate = new X509Certificate2(this.appleSettings.CertificateData, this.appleSettings.CertificateFilePassword, X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.Exportable); certificates = new X509CertificateCollection(); certificates.Add(certificate); //Start our cleanup task taskCleanup = new Task(() => Cleanup(), TaskCreationOptions.LongRunning); taskCleanup.ContinueWith((t) => { var ex = t.Exception; }, TaskContinuationOptions.OnlyOnFaulted); taskCleanup.Start(); }
public PushServiceBase(TChannelSettings channelSettings, PushServiceSettings serviceSettings = null) { this.ServiceSettings = serviceSettings ?? new PushServiceSettings(); this.ChannelSettings = channelSettings; this.queuedNotifications = new ConcurrentQueue <Notification>(); timerCheckScale = new Timer(new TimerCallback((state) => { CheckScale(); }), null, TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(15)); CheckScale(); distributerTask = new Task(Distributer, TaskCreationOptions.LongRunning); distributerTask.ContinueWith((ft) => { var ex = ft.Exception; }, TaskContinuationOptions.OnlyOnFaulted); distributerTask.Start(); stopping = false; }
public PushServiceBase(PushChannelSettings channelSettings, PushServiceSettings serviceSettings = null) { this.ServiceSettings = serviceSettings ?? new PushServiceSettings(); this.ChannelSettings = channelSettings; this.queuedNotifications = new ConcurrentQueue<Notification>(); timerCheckScale = new Timer(new TimerCallback((state) => { CheckScale(); }), null, TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(15)); CheckScale(); distributerTask = new Task(Distributer, TaskCreationOptions.LongRunning); distributerTask.ContinueWith((ft) => { var ex = ft.Exception; }, TaskContinuationOptions.OnlyOnFaulted); distributerTask.Start(); stopping = false; }
public AndroidPushService(PushChannelSettings channelSettings, PushServiceSettings serviceSettings = null) : base(channelSettings, serviceSettings) { }
public WindowsPhonePushChannel(WindowsPhonePushChannelSettings channelSettings, PushServiceSettings serviceSettings = null) : base(channelSettings, serviceSettings) { windowsPhoneSettings = channelSettings; }
public GcmPushService(GcmPushChannelSettings channelSettings, PushServiceSettings serviceSettings = null) : base(new GcmPushChannelFactory(channelSettings), serviceSettings) { }
public void StartBlackberryPushService(Blackberry.BlackberryPushChannelSettings channelSettings, PushServiceSettings serviceSettings = null) { bbService = new Blackberry.BlackberryPushService(channelSettings, serviceSettings); bbService.Events.RegisterProxyHandler(this.Events); }
public void StartApplePushService(Apple.ApplePushChannelSettings channelSettings, PushServiceSettings serviceSettings = null) { appleService = new Apple.ApplePushService(channelSettings, serviceSettings); appleService.Events.RegisterProxyHandler(this.Events); }
public void StartAndroidPushService(Android.C2dmPushChannelSettings channelSettings, PushServiceSettings serviceSettings = null) { androidService = new Android.C2dmPushService(channelSettings, serviceSettings); androidService.Events.RegisterProxyHandler(this.Events); }
public void StartWindowsPushService(Windows.WindowsPushChannelSettings channelSettings, PushServiceSettings serviceSettings = null) { winService = new Windows.WindowsPushService(channelSettings, serviceSettings); winService.Events.RegisterProxyHandler(this.Events); }
public ChannelScalerImpl(PushServiceSettings settings, ChannelLoadBalancer loadBalancer) { this.ServiceSettings = settings; this.ChannelLoadBalancer = loadBalancer; }
public BlackberryPushService( BlackberryPushChannelSettings channelSettings, PushServiceSettings serviceSettings) : base(new BlackberryPushChannelFactory(channelSettings), serviceSettings) { }
public WindowsPhonePushService( WindowsPhonePushChannelSettings channelSettings, PushServiceSettings serviceSettings = null) : base(new WindowsPhoneChannelFactory(channelSettings), serviceSettings) { }
public void StartGoogleCloudMessagingPushService(Android.GcmPushChannelSettings channelSettings, PushServiceSettings serviceSettings = null) { gcmService = new Android.GcmPushService(channelSettings, serviceSettings); gcmService.Events.RegisterProxyHandler(this.Events); }
public GcmPushService(GcmPushChannelSettings channelSettings, PushServiceSettings serviceSettings = null) : base(channelSettings, serviceSettings) { }