Giter Club home page Giter Club logo

Comments (3)

stevenharman avatar stevenharman commented on July 20, 2024

This backtrace looks like the problem is in your NotificationsController#create rather than in Grocer. Is this happening in a test?

from grocer.

alifjamaluddin avatar alifjamaluddin commented on July 20, 2024

I'm not write any test for that notifications controller yet. Do I need to write it? Is the error related to the test?

This is the method I used to do push notification.

def push(a,b,c)
    devices = Device.where(:user_id => b)
    devices.each do |device|

    pusher = Grocer.pusher(certificate: "#{Rails.root}/lib/PUSHNOTICERT.pem", # required
                           passphrase:  "megasap1",                         # optional
                           gateway:     "gateway.sandbox.push.apple.com", # optional
                           port:        2195,                             #optional
                           retries:     3)

    feedback = Grocer.feedback( certificate: "#{Rails.root}/lib/SLPushNotifDevCertAndKeys.pem", 
                                      passphrase:  "megasap1",                        
                                      gateway:     "feedback.sandbox.push.apple.com", 
                                      port:        2196,                     
                                      retries:     3)

    # message = params["message"]
        message = a 
         notification = Grocer::Notification.new(
        device_token:      device.device_token,
        alert:             message,
        badge:             3,
        sound:             "siren.aiff",         # optional
        expiry:            Time.now + 60*60,     # optional; 0 is default, meaning the message is not stored
        identifier:        c                 # optional
        # content_available: true                  # optional; any truthy value will set 'content-available' to 1
      )




     if pusher.push(notification)
        render :json=> {:status => true}
     else
        render :json=> {:status => false}
     end
    end

     feedback.each do |attempt|
        puts "Device #{attempt.device_token} failed at #{attempt.timestamp}"
     end
end

from grocer.

stevenharman avatar stevenharman commented on July 20, 2024

Hello @alifjamaluddin. I'm going to close this Issue due to inactivity. Please re-open it if you are still experiencing the problem and/or have more information to add.

Thank you!

from grocer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.