kayac / gunfish Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
It is too short period to retry, so should expands that period.
FCM recommends migrate old HTTP API to HTTP v1 API.
https://firebase.google.com/docs/cloud-messaging/migrate-v1
Values for the APNs JSON reason
key have changed and thus we should update ErrorMessage const
in github.com/kayac/Gunfish/apns/error.go.
Previous documentation(web.archive.org because that page cannot be found.):
https://web.archive.org/web/20160902182330/https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/APNsProviderAPI.html
Current documentation:
https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html
When many error occur, It is often high cpu usage.
So, some command workers spawn in advance and continue to use own stdin until died.
Sending a request like the one below fails to set the Header parameters sent to the APNS server
[{
"header": {
"apns-topic": "com.kayac.mypackage"
},
"token": "XXXXXXX",
"payload": {
"aps": {
"alert": {
"body": "test"
}
}
}
}]
The response in the error hook clearly shows that the header has not been set:
{"response":{"apns-id":"","status":400},"response_time":0.371444302,"request":{"header":{},"token":"XXXXXXX","payload":{"aps":{"alert":{"body":"test"}}},"tries":0},"error_msg":{"reason":"MissingTopic","timestamp":0},"resp_uid":"aaaaaaaaa"}
Gunfish doesn't retry when some FCM v1 errors occur.
When FCM returns INTERNAL
or UNAVAILABLE
error, it should be retried.
https://firebase.google.com/docs/cloud-messaging/http-server-ref?hl=ja#error-codes
{
"file": "/home/runner/work/Gunfish/Gunfish/supervisor.go",
"level": "error",
"line": "432",
"msg": "Unknown error message: INTERNAL",
"res_queue_size": 0,
"resend_cnt": 0,
"resp_uid": "6d9db339-bcdf-4db5-9b64-14b671e978ec",
"response_time": 5.047958725,
"time": "2024-03-26T13:07:19Z",
"token": "xxx",
"type": "worker",
"worker_id": 61
}
https://firebase.google.com/docs/cloud-messaging/migrate-v1
Apps using the deprecated FCM legacy APIs for HTTP and XMPP should migrate to the HTTP v1 API at the earliest opportunity. Sending messages (including upstream messages) with those APIs was deprecated on June 20, 2023, and will be removed in June 2024.
FCM Legacy API will be removed soon. Gunfish will drop supports the legacy API (/push/fcm).
FCM returns NotRegistered
, but Gunfish can't handle the errors.
Lines 399 to 405 in febcd2e
Google FCMv1 endpoint returns 'NOT_FOUND' error message if token is replaced. So the error hook should be invoked to remove the old token.
Steps to reproduce:
Result:
time="2020-01-23T09:25:02Z" level=error msg="Unknown error message: NOT_FOUND" file=/home/circleci/project/supervisor.go line=432 res_queue_size=0 resend_cnt=0 resp_uid=07cd1248-7ee4-4d9c-9169-894cce461274 response_time=0.3715487 token="[redacted]" type=worker worker_id=0
(Tested with v0.4.1-rc2 Docker container: https://hub.docker.com/r/kayac/gunfish/tags?page=1&ordering=last_updated)
To me it looks like FCM is responding something like this, where the status is NOT_FOUND
but the details errorCode is UNREGISTERED
:
{
"error": {
"code": 404,
"message": "Requested entity was not found.",
"status": "NOT_FOUND",
"details": [
{
"@type": "type.googleapis.com/google.firebase.fcm.v1.FcmError",
"errorCode": "UNREGISTERED"
}
]
}
}
This is also discussed in similar projects facing the same issue:
I don't want to invoke a command by error_hook, because my APNS tokens list includes too many invalid tokens.
I hope to run Gunfish with no error_hook, and I will scan the Gunfish logs and find invalid tokens from that logs at first.
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.