Git Product home page Git Product logo

go-push-receiver's Introduction

go-push-receiver

GoDoc Go Report Card MIT License Github Actions

A library to subscribe to GCM/FCM and receive notifications.

This library was developed inspired by push-receiver (https://github.com/MatthieuLemoine/push-receiver/).

Build

  1. install protoc
brew install protobuf
  1. build
$ go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
$ protoc -I=proto --go_out=pb/mcs proto/mcs.proto
$ protoc -I=proto --go_out=pb/checkin proto/checkin.proto
$ protoc -I=proto --go_out=pb/checkin proto/android_checkin.proto
$ go build

License

MIT License

proto file is licensed by is The Chromium Authors. (BSD-style license) (copied it from https://chromium.googlesource.com/chromium/chromium/+/trunk/google_apis/gcm/protocol/)

go-push-receiver's People

Stargazers

 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

go-push-receiver's Issues

unable to register token

i am using a standard receiver example. launch app with a random id -sender-id 1378199887347.

after launch I get an error:
push: 2023/10/18 12:16:09 client.go:86: Sender ID: 1378199887347
app : 2023/10/18 12:16:11 main.go:91: retry : server error: 400 Bad Request, 470.708448ms
app : 2023/10/18 12:16:13 main.go:91: retry : server error: 400 Bad Request, 12.850598423s

how to fix the problem? a similar library on JS works without problems.

How to receive new notifications only.

i've setup the listener and its working, the only issue is that whenever I restart the program the client.Events channel keeps getting filled with old notifications that ive already seen on the previous run. is there a way to either offset the messasges or only receive the pushes that come after the listener has started?

fcm send error: request contains an invalid argument

Hi, thanks for creating this library, I found it very useful.
It has been working well until recently. However, recently, any newly registered token cannot be sent notification to (due to "invalid token type" error), while existing (previously registered with the same code) tokens are unaffected.

I tried on both a macOS and Linux machine and were able to reproduce the error with /examples in both cases.

Could you please test it and see if you're also seeing the error? Thanks!

how can I use it

hello, i need to receive push notifications from a third party android app, i intended to use this library as it seems the most complete i've found.

could you tell me how to generate valid credentials to receive push notifications and the token that should give google services to the app.

Heartbeat Question

Hi crow-misia,

Im trying to convert your go code to C#.
Could you explain to me why do you use Heartbeat.start method for send heartbeat ping with timer ?

You can set LoginRequest like this and you will receive Heartbeatping and after that you can send HeartbeatAck

loginRequest.Setting.Add(new Setting() { Name = FirebaseConstant.kHeartbeatIntervalSettingName, Value = "10000" });

pushreceiver.(*Client).checkIn is not working maybe is timeout

Hello.

Desired result:

  • Successfully subscribed to the message

Actual result:

  • I used roughly the same code as the "example"
  • Only senderId is set, credsFile and persistentIdFile are empty files
  • The program did not return a result when executing checkIn, and there was no timeout response.
  • There is no timeout response probably because the default http client does not set a timeout.

question:

Why didn't checkin succeed?

Source Code, realMain is same with "example code".

func Test_receiver(t *testing.T) {

	senderId := "375682587912"
	credsFilename := "credentials.json"
	persistentIdFilename := "persistent_id.txt"

	ctx := context.Background()
	realMain(ctx, senderId, credsFilename, persistentIdFilename)

}
image
  • Checkin http request is not respond,program is in the "pending" state.

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.