Code Monkey home page Code Monkey logo

gunfish's People

Contributors

dependabot[bot] avatar ebi-yade avatar fujiwara avatar handlename avatar mamimumemoomoo avatar serinuntius avatar shogo82148 avatar takyoshi avatar tkyshm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gunfish's Issues

Should update values for the reason key.

Request.Header parameters should be customizable

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"}

Retry on some FCM v1 errors occur.

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
}

Drop Legacy FCM support.

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).

"Unknown error message: NotRegistered"

FCM returns NotRegistered, but Gunfish can't handle the errors.

Gunfish/supervisor.go

Lines 399 to 405 in febcd2e

if err.Error() == fcm.InvalidRegistration.String() {
// TODO: should delete registration_id from server data store
onResponse(result, errorResponseHandler.HookCmd(), cmdq)
LogWithFields(logf).Errorf("%s", err)
} else {
LogWithFields(logf).Errorf("Unknown error message: %s", err)
}

Error hook not invoked if FCMv1 endpoint returns 'NOT_FOUND'

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:

  1. Registered a device (and successfully sent a message via FCMv1 gateway)
  2. Deleted app and reregistered device (results in new token, with the first beeing still stored)
  3. Send message to the old (and now orphan) token

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:

error_hook cannot be empty.

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.

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.