calonso / rails-push-notifications

Rails iOS, Android and Windows Phone Push Notifications made easy!!
https://rubygems.org/gems/rails-push-notifications
MIT License
138 stars 44 forks source link

Errno::ECONNRESET PushNotificationController -- Connection reset by peer #9

Closed lmahendra closed 8 years ago

lmahendra commented 8 years ago

I am getting "Connection reset by peer" since yesterday and not able to push notifications on apns. It was working fine earlier, don't know how to solve the error. Confirmed certificates being used are proper and active. I am using OpenSSL 1.0.1k-fips, ruby 2.2.1p85, gem 2.4.8, Rails 4.2.4. please suggest what could be the issue.

lmahendra commented 8 years ago

It went through when I tried from https://rails-push-notifications-test.herokuapp.com/apple with same pem file and device token. what could be the issue at server?

calonso commented 8 years ago

Hi @lmahendra, can you provide a bit more background? It sounds strange that works through the test project on heroku and not in your local.

Just to double check differences you can checkout the code running in heroku here, and run it locally and see if it runs.

Cheers!

lmahendra commented 8 years ago

Hi @calonso , thanks for reply. It seems to be some kind of error with open ssl. here is the log

Errno::ECONNRESET: Connection reset by peer from /home/user/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/openssl/buffering.rb:326:in syswrite' from /home/user/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/openssl/buffering.rb:326:indo_write' from /home/user/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/openssl/buffering.rb:344:in write' from /home/user/.rvm/gems/ruby-2.2.1/gems/ruby-push-notifications-0.4.0/lib/ruby-push-notifications/apns/apns_pusher.rb:45:inpush' from /home/user/.rvm/gems/ruby-2.2.1/gems/rails-push-notifications-0.2.2/lib/rails-push-notifications/apps/base_app.rb:24:in `push_notifications'

lmahendra commented 8 years ago

Hi @calonso , I tried as u suggested checking out test code on my local system and it went through, with no error whatsoever. Now I want to make it happen on the server as well, what would u suggest I should do? Do I need to change particular file or gem so that it work?

lmahendra commented 8 years ago

update: I uploaded test code on server as well and tried with different url, and notifications were pushed successfully. This is really making me pull hairs as not getting it to work for live site. Can you please help..! Thanks.

calonso commented 8 years ago

Hi @lmahendra, this looks like a typical 'silly mistake', but they're hard to find. I don't really know where the error may come from, but I'd suggest you debug both sources and compare and see where they differ. As far as I can see, on your project you're using version 0.4.0 of the internal ruby-push-notifications gem, while the example test project uses 0.3.0. IIRC, the only difference between them is that 0.4.0 supports password-protected .pem files...

Maybe is not related to the different version fact, but having one project that works is a great place to be in, because you can compare it against the failing one, spot the difference(s) and make them look like the one that is working.

Hope it helps.

lmahendra commented 8 years ago

Hi @calonso , you are right, it was typically a silly mistake. It was some problem with .pem file that I stored in database. I don't know how it got jumbled, but when I tried with same pem file creating new apns app, it started to work again. Anyways, thanks for ur time, this learned me a lesson, how big issue seems to be, first confirm the basics.

Cheers Now!

calonso commented 8 years ago

Glad you found it!!

Cheers!