예제 #1
0
		public void Blackberry_Simple_Test()
		{
			var waitCallback = new ManualResetEvent (false);

		    var settings = new BlackberryPushChannelSettings("APPID", "PWD"); 

			var c = new BlackberryPushChannel (settings);

			var n = new BlackberryNotification ();
		    n.Content = new BlackberryMessageContent("text/plain", "66");

			n.QualityOfService = QualityOfServiceLevel.Unconfirmed;
		    n.SourceReference = "3682-8s4B97Rc2388i46I8M08769D005ra6286o4";
		    n.DeliverBeforeTimestamp = DateTime.UtcNow.AddMinutes(1);
			var r = new BlackberryRecipient ("push_all");

			n.Recipients.Add (r);

			c.SendNotification (n, (sender, resp) => {

				waitCallback.Set();
			});

			waitCallback.WaitOne ();
		}
예제 #2
0
            public Task <HttpResponseMessage> PostNotification(BlackberryPushChannelSettings channelSettings, BlackberryNotification n)
            {
                var c = new MultipartContent("related", channelSettings.Boundary);

                c.Headers.Remove("Content-Type");
                c.Headers.TryAddWithoutValidation("Content-Type", "multipart/related; boundary=" + channelSettings.Boundary + "; type=application/xml");

                var xml = n.ToPapXml();


                c.Add(new StringContent(xml, Encoding.UTF8, "application/xml"));

                var bc = new ByteArrayContent(n.Content.Content);

                bc.Headers.Add("Content-Type", n.Content.ContentType);

                foreach (var header in n.Content.Headers)
                {
                    bc.Headers.Add(header.Key, header.Value);
                }

                c.Add(bc);

                return(PostAsync(channelSettings.SendUrl, c));
            }
예제 #3
0
        public BlackberryPushChannel(BlackberryPushChannelSettings channelSettings, Common.PushServiceSettings serviceSettings = null)
            : base(channelSettings, serviceSettings)
        {
            blackberrySettings = channelSettings;
            transport = new BlackberryMessageTransportAsync();

            transport.MessageResponseReceived += new Action<BlackberryMessageTransportResponse>(transport_MessageResponseReceived);
            transport.UnhandledException += new Action<BlackberryNotification, Exception>(transport_UnhandledException);
        }
예제 #4
0
			public BlackberryHttpClient(BlackberryPushChannelSettings channelSettings) : base()
			{
			    this.channelSettings = channelSettings;

                var authInfo = channelSettings.ApplicationId + ":" + channelSettings.Password;
                authInfo = Convert.ToBase64String(Encoding.Default.GetBytes(authInfo));

                this.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authInfo);
			    this.DefaultRequestHeaders.ConnectionClose = true;

			    this.DefaultRequestHeaders.Remove("connection");
			}
예제 #5
0
            public BlackberryHttpClient(BlackberryPushChannelSettings channelSettings) : base()
            {
                this.channelSettings = channelSettings;

                var authInfo = channelSettings.ApplicationId + ":" + channelSettings.Password;

                authInfo = Convert.ToBase64String(Encoding.Default.GetBytes(authInfo));

                this.DefaultRequestHeaders.Authorization   = new AuthenticationHeaderValue("Basic", authInfo);
                this.DefaultRequestHeaders.ConnectionClose = true;

                this.DefaultRequestHeaders.Remove("connection");
            }
예제 #6
0
			public Task<HttpResponseMessage> PostNotification(BlackberryPushChannelSettings channelSettings, BlackberryNotification n)
			{
				var c = new MultipartContent ("related", channelSettings.Boundary);
                c.Headers.Remove("Content-Type");
                c.Headers.TryAddWithoutValidation("Content-Type", "multipart/related; boundary=" + channelSettings.Boundary + "; type=application/xml");
				
				var xml = n.ToPapXml ();


				c.Add (new StringContent (xml, Encoding.UTF8, "application/xml"));

			    var bc = new ByteArrayContent(n.Content.Content);
                bc.Headers.Add("Content-Type", n.Content.ContentType);
                
                foreach (var header in n.Content.Headers)
                    bc.Headers.Add(header.Key, header.Value);

                c.Add(bc);
			
				return PostAsync (channelSettings.SendUrl, c);
			}
		public static void RegisterBlackberryService(this PushBroker broker, BlackberryPushChannelSettings channelSettings, IPushServiceSettings serviceSettings = null)
		{
			RegisterBlackberryService (broker, channelSettings, null, serviceSettings);
		}
		public static void RegisterBlackberryService(this PushBroker broker, BlackberryPushChannelSettings channelSettings, string applicationId = null, IPushServiceSettings serviceSettings = null)
		{
			broker.RegisterService<BlackberryNotification>(new BlackberryPushService(channelSettings, serviceSettings), applicationId);
		}
예제 #9
0
 public BlackberryPushChannel(BlackberryPushChannelSettings channelSettings, Common.PushServiceSettings serviceSettings = null)
     : base(channelSettings, serviceSettings)
 {
     blackberrySettings = channelSettings;
 }
예제 #10
0
 public BlackberryPushService(IPushChannelFactory pushChannelFactory, BlackberryPushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
     : base(pushChannelFactory ?? new BisPushChannelFactory(), channelSettings ?? new BlackberryPushChannelSettings(), serviceSettings)
 {
 }
예제 #11
0
        public BlackberryPushChannel(BlackberryPushChannelSettings channelSettings)
        {
            bisChannelSettings = channelSettings;

            http = new BlackberryHttpClient(bisChannelSettings);
        }
예제 #12
0
 public BlackberryPushChannel(BlackberryPushChannelSettings channelSettings) : this(channelSettings, null)
 {
 }
예제 #13
0
 public void StartBlackberryPushService(Blackberry.BlackberryPushChannelSettings channelSettings, PushServiceSettings serviceSettings = null)
 {
     bbService = new Blackberry.BlackberryPushService(channelSettings, serviceSettings);
     bbService.Events.RegisterProxyHandler(this.Events);
 }
 public BlackberryPushChannelFactory(BlackberryPushChannelSettings channelSettings)
 {
     this.channelSettings = channelSettings;
 }
예제 #15
0
 public BlackberryPushService(BlackberryPushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
     : this(default(IPushChannelFactory), channelSettings, serviceSettings)
 {
 }
예제 #16
0
 public BlackberryPushService(IPushChannelFactory pushChannelFactory, BlackberryPushChannelSettings channelSettings)
     : this(pushChannelFactory, channelSettings, default(IPushServiceSettings))
 {
 }
예제 #17
0
 public BlackberryPushService(BlackberryPushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
     : this(default(IPushChannelFactory), channelSettings, serviceSettings)
 {
 }
예제 #18
0
 public BlackberryPushService(BlackberryPushChannelSettings channelSettings, Common.PushServiceSettings serviceSettings)
     : base(channelSettings, serviceSettings)
 {
 }
예제 #19
0
 public BlackberryPushService(IPushChannelFactory pushChannelFactory, BlackberryPushChannelSettings channelSettings)
     : this(pushChannelFactory, channelSettings, default(IPushServiceSettings))
 {
 }
예제 #20
0
        public BlackberryPushChannel(BlackberryPushChannelSettings channelSettings)
        {
            bisChannelSettings = channelSettings;

            http = new BlackberryHttpClient(bisChannelSettings);
        }
예제 #21
0
 public BlackberryPushService(IPushChannelFactory pushChannelFactory, BlackberryPushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
     : base(pushChannelFactory ?? new BisPushChannelFactory(), channelSettings ?? new BlackberryPushChannelSettings(), serviceSettings)
 {
 }
예제 #22
0
 public BlackberryPushChannel(BlackberryPushChannelSettings channelSettings, Common.PushServiceSettings serviceSettings = null) : base(channelSettings, serviceSettings)
 {
     blackberrySettings = channelSettings;
 }
예제 #23
0
 public BlackberryPushService(
     BlackberryPushChannelSettings channelSettings, PushServiceSettings serviceSettings)
     : base(new BlackberryPushChannelFactory(channelSettings), serviceSettings)
 {
 }