All Projects → NaySoftware → Go Fcm

NaySoftware / Go Fcm

Licence: gpl-2.0
Firebase Cloud Messaging ( FCM ) Library using golang ( Go )

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Go Fcm

Pyfcm
Python client for FCM - Firebase Cloud Messaging (Android, iOS and Web)
Stars: ✭ 674 (+217.92%)
Mutual labels:  firebase, firebase-cloud-messaging, fcm
Pushraven
A simple Java library to interface with Firebase Cloud Messaging (FCM) API. Pushraven allows you to push notifications to clients in very few lines of code.
Stars: ✭ 67 (-68.4%)
Mutual labels:  firebase, firebase-cloud-messaging, fcm
Kotlin Firebase Group Chat
Group and OneonOne chat using firebase built in Kotlin similar to whatsapp.
Stars: ✭ 44 (-79.25%)
Mutual labels:  firebase, firebase-cloud-messaging, fcm
Fcm Toolbox
📲 Firebase Cloud Messaging toolbox
Stars: ✭ 217 (+2.36%)
Mutual labels:  firebase, firebase-cloud-messaging, fcm
Fcm
Firebase Cloud Messaging (FCM) notifications channel for Laravel
Stars: ✭ 169 (-20.28%)
Mutual labels:  firebase, firebase-cloud-messaging, fcm
Firebase Php
Unofficial Firebase Admin SDK for PHP
Stars: ✭ 1,657 (+681.6%)
Mutual labels:  firebase, firebase-cloud-messaging
Hify
Social network powered by firebase
Stars: ✭ 115 (-45.75%)
Mutual labels:  firebase, firebase-cloud-messaging
Godotfirebase
FireBase for godot
Stars: ✭ 199 (-6.13%)
Mutual labels:  firebase, firebase-cloud-messaging
Push Receiver
A library to subscribe to GCM/FCM and receive notifications within a node process.
Stars: ✭ 125 (-41.04%)
Mutual labels:  firebase-cloud-messaging, fcm
Firebase Admin Node
Firebase Admin Node.js SDK
Stars: ✭ 1,050 (+395.28%)
Mutual labels:  firebase, firebase-cloud-messaging
Fcm
Enable Firebase Cloud Messaging for Capacitor apps
Stars: ✭ 120 (-43.4%)
Mutual labels:  firebase, fcm
Firebasecloudmessaging Android
FCM is just a demo of Android Application which implement Firebase Cloud Messaging. It made for Google I/O Extended 2016 Bangkok
Stars: ✭ 126 (-40.57%)
Mutual labels:  firebase, firebase-cloud-messaging
Laqul
A complete starter kit that allows you create amazing apps that look native thanks to the Quasar Framework. Powered by an API developed in Laravel Framework using the easy GraphQL queries language. And ready to use the Google Firebase features.
Stars: ✭ 110 (-48.11%)
Mutual labels:  firebase, firebase-cloud-messaging
React Native Firebase
🔥 A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
Stars: ✭ 9,674 (+4463.21%)
Mutual labels:  firebase, fcm
Fcmsharp
Firebase Cloud Messaging (FCM) with .NET
Stars: ✭ 115 (-45.75%)
Mutual labels:  firebase, firebase-cloud-messaging
Quickstart Cpp
Firebase Quickstart Samples for C++
Stars: ✭ 123 (-41.98%)
Mutual labels:  firebase, firebase-cloud-messaging
Rpush
The push notification service for Ruby.
Stars: ✭ 1,886 (+789.62%)
Mutual labels:  firebase-cloud-messaging, fcm
React Native Fcm
react native module for firebase cloud messaging and local notification
Stars: ✭ 1,729 (+715.57%)
Mutual labels:  firebase, fcm
Electron Push Receiver
A module to bring Web Push support to Electron allowing it to receive notifications from Firebase Cloud Messaging (FCM).
Stars: ✭ 158 (-25.47%)
Mutual labels:  firebase-cloud-messaging, fcm
Cocos2dx Cpp Sample
Firebase Cocos2d-x samples
Stars: ✭ 42 (-80.19%)
Mutual labels:  firebase, firebase-cloud-messaging

go-fcm : FCM Library for Go

Firebase Cloud Messaging ( FCM ) Library using golang ( Go )

This library uses HTTP/JSON Firebase Cloud Messaging connection server protocol

Features
  • Send messages to a topic
  • Send messages to a device list
  • Message can be a notification or data payload
  • Supports condition attribute (fcm only)
  • Instace Id Features
    • Get info about app Instance
    • Subscribe app Instance to a topic
    • Batch Subscribe/Unsubscribe to/from a topic
    • Create registration tokens for APNs tokens

Usage

go get github.com/NaySoftware/go-fcm

Docs - go-fcm API

https://godoc.org/github.com/NaySoftware/go-fcm

Firebase Cloud Messaging HTTP Protocol Specs

https://firebase.google.com/docs/cloud-messaging/http-server-ref

Firebase Cloud Messaging Developer docs

https://firebase.google.com/docs/cloud-messaging/

(Google) Instance Id Server Reference

https://developers.google.com/instance-id/reference/server

Notes

a note from firebase console

Firebase Cloud Messaging tokens have replaced server keys for
sending messages. While you may continue to use them, support
is being deprecated for server keys.
Firebase Cloud Messaging token ( new token )

serverKey variable will also hold the new FCM token by Firebase Cloud Messaging

Firebase Cloud Messaging token can be found in:

  1. Firebase project settings
  2. Cloud Messaging
  3. then copy the Firebase Cloud Messaging token
Server Key

serverKey is the server key by Firebase Cloud Messaging

Server Key can be found in:

  1. Firebase project settings
  2. Cloud Messaging
  3. then copy the server key

[will be deprecated by firabase as mentioned above!]

Retry mechanism

Retry should be implemented based on the requirements. Sending a request will result with a "FcmResponseStatus" struct, which holds a detailed information based on the Firebase Response, with RetryAfter (response header) if available - with a failed request. its recommended to use a backoff time to retry the request - (if RetryAfter header is not available).

Examples

Send to A topic


package main

import (
	"fmt"
    "github.com/NaySoftware/go-fcm"
)

const (
	 serverKey = "YOUR-KEY"
     topic = "/topics/someTopic"
)

func main() {

	data := map[string]string{
		"msg": "Hello World1",
		"sum": "Happy Day",
	}

	c := fcm.NewFcmClient(serverKey)
	c.NewFcmMsgTo(topic, data)


	status, err := c.Send()


	if err == nil {
    status.PrintResults()
	} else {
		fmt.Println(err)
	}

}


Send to a list of Devices (tokens)


package main

import (
	"fmt"
    "github.com/NaySoftware/go-fcm"
)

const (
	 serverKey = "YOUR-KEY"
)

func main() {

	data := map[string]string{
		"msg": "Hello World1",
		"sum": "Happy Day",
	}

  ids := []string{
      "token1",
  }


  xds := []string{
      "token5",
      "token6",
      "token7",
  }

	c := fcm.NewFcmClient(serverKey)
    c.NewFcmRegIdsMsg(ids, data)
    c.AppendDevices(xds)

	status, err := c.Send()


	if err == nil {
    status.PrintResults()
	} else {
		fmt.Println(err)
	}

}



Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].