Redth / PushSharp

A server-side library for sending Push Notifications to iOS (iPhone/iPad APNS), Android (C2DM and GCM - Google Cloud Message), Windows Phone, Windows 8, Amazon, Blackberry, and (soon) FirefoxOS devices!
Other
4.38k stars 1.52k forks source link

PushSharp on Mono in MVC #22

Closed nicwise closed 12 years ago

nicwise commented 12 years ago

Hi there

I'm doing a push from a MVC3 app, running on a Linode.

If I do it locally (ie, on my windows machine) it works fine. Same code on the linode says its sent it, but it never gets the Events_OnNotificationSent event fire.

I have the pushservice object setup as a static, but I've also tried it local to the controller method.

Any ideas? Any way to see error logs from it? I'm not getting a Events_OnNotificationSendFailure (or anything else) either. It just disappears into the ether.

I'm going to try it on my mac tonight to see if it's a mono issue, but have you had it working on Mono on a server at all?

Thanks

Nic

nicwise commented 12 years ago

Just had a bit more of a play - iptables is blocking incoming port 2196 which appears to be the feedback service talking to me. Not sure why it works on windows tho! My Linode is on the internet - my work desktop is behind a lot more firewalls.

nicwise commented 12 years ago

I found the issue in the end. It was this, in ApplePushChannel.cs, around line 370

''' try { stream.AuthenticateAsClient(this.appleSettings.Host, this.certificates, System.Security.Authentication.SslProtocols.Ssl3, false); //stream.AuthenticateAsClient(this.appleSettings.Host); } catch (System.Security.Authentication.AuthenticationException ex) { throw new ConnectionFailureException("SSL Stream Failed to Authenticate as Client", ex); }

'''

It WAS using the commented out line, and the first one was commented out. I swapped them. Now it works fine on Mono, and I can send messages to passkit to refresh the pass! :)