miyataka / fcmpush Goto Github PK
View Code? Open in Web Editor NEWFirebase Cloud Messaging API wrapper for Ruby, suppot HTTP v1 API including access_token auto refresh feature.
License: MIT License
Firebase Cloud Messaging API wrapper for Ruby, suppot HTTP v1 API including access_token auto refresh feature.
License: MIT License
I recently received a notice from FCM indicating that the Server Key feature will be deprecated on June 20, 2024.
However, I'm not sure if he meant the auth method that would affect subscribe/unsubscribe or if the entire API would be affected. Google developer documentation is so hard to read.
Ruby 3.0.1 was released today - https://www.ruby-lang.org/en/news/2021/04/05/ruby-3-0-1-released/
And It started to present this message on github actions:
_fcmpush-1.3.1 requires ruby version <= 3.0, >= 2.4, which is incompatible with the current version, ruby 3.0.1p64_
The gemspec needs to be updated - https://github.com/miyataka/fcmpush/blob/main/fcmpush.gemspec
Hi!
I just wanted to use the batch sending feature when I discovered that it was deprecated by Google June 20, 2023 and will be shut down June 21, 2024.
See here for details: https://firebase.google.com/support/faq/#fcm-depr-features
I suggest to add a warning to the feature and/or disable it.
And possible migrate to HTTP/2 as suggested.
How can i configure multiple json_key_io and send notification to multiple firebase users
If you really want it, please vote by π
If you don't need it, please vote by π€· or some
If you don't use mutiple configuration, The bug is nothing. Never Mind.
TODO:
I've noticed when setting up fcmpush that it would break if getting a 403 from push call.
I noticed it since I have multiple projects and tried to send to a device token generated by the other project.
I got the following response:
Fcmpush::Forbidden: Receieved an error response 403 Forbidden: {
"error": {
"code": 403,
"message": "SenderId mismatch",
"status": "PERMISSION_DENIED",
"details": [
{
"@type": "type.googleapis.com/google.firebase.fcm.v1.FcmError",
"errorCode": "SENDER_ID_MISMATCH"
}
]
}
}
subsequent calls to Fcmpush.new(project_id) would throw this error: MultiJson::ParseError: compile error
This is because I guess it was trying to re-auth against google and thus calling .read on json_key_io.
However reading the same StringIO multiple times would just return empty string on subsequent calls.
2.4.10 :005 > sio = StringIO.new("test")
=> #<StringIO:0x00007fc49d683670>
2.4.10 :006 > sio.read
=> "test"
2.4.10 :007 > sio.read
=> ""
There might be some other edgecases when specifying json_key_io as an instance of StringIO
Is there some other ruby-class that would provide the same interface as IO but keeping string buffer upon read?
My ugly hack as of now was just to wrap the string in a struct with an accessor for the attribute read
config.json_key_io = Struct.new(:read).new credentials
This is an improvement suggestion.
Reference: https://github.com/miyataka/fcmpush#usage
The following error is raised:
NoMethodError:
undefined method `gsub' for nil:NilClass
Rescue the NoMethodError and raises a custom error with information regarding the missing configuration
Thanks for your time and for the good work.
I i use fcmpush behind a proxy, the http_proxy
or https_proxy
environment variable is not considered, so the push will run into timeout:
A network error occurred: Net::OpenTimeout (Failed to open TCP connection to fcm.googleapis.com:443 (execution expired))
It would be nice, if i can set a proxy server in the fcmpush configuration, which is used for the requests, like this:
Fcmpush.configure do |config|
config.json_key_io = "#{Rails.root}/path/to/service_account_credentials.json"
config.server_key = 'your firebase server key'
config.proxy_server = 'http://myproxyserver:3128'
end
Otherwise if the environment variables http_proxy
/ https_proxy
/ HTTP_PROXY
/ HTTPS_PROXY
would be used if set, might be another approach.
Always getting this error
Please make clear overview which steps to take with fcm
I think but donβt understand why the android app is using something different as the fcm credentials
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.