tnpg

package
v0.20.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2022 License: GPL-3.0 Imports: 11 Imported by: 0

README

TNPG: Push Gateway

This is push notifications adapter which communicates with Tinode Push Gateway (TNPG).

TNPG is a proprietary service intended to simplify deployment of on-premise installations. Deploying a Tinode server without TNPG requires configuring Google FCM with your own credentials, recompiling Android and iOS clients, releasing them to PlayStore and AppStore under your own accounts. It's usually time consuming and relatively complex.

TNPG solves this problem by allowing you to send push notifications on behalf of Tinode: you hand a notification over to Tinode, Tinode sends it to client using its own credentials and certificates. Internally it uses Google FCM and as such supports the same platforms as FCM. The main advantage of using TNPG over FCM is simplicity of configuration: mobile clients don't have to be recompiled, all is needed is a configuration update on the server.

Configuring TNPG adapter

Obtain TNPG token
  1. Register at https://console.tinode.co and create an organization.
  2. Get the TPNG token from the Self hosting section by following the instructions there.
Configure the server

Update the server config tinode.conf, section "push" -> "name": "tnpg":

{
  "enabled": true,
  "org": "myorg", // Short name (URL) of the organization you registered at console.tinode.co
  "token": "SoMe_LonG.RaNDoM-StRiNg.12345" // authentication token obtained from console.tinode.co
}

Make sure the fcm section is disabled "enabled": false or removed altogether.

Documentation

Overview

Package tnpg implements push notification plugin for Tinode Push Gateway.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler represents state of TNPG push client.

func (Handler) Channel

func (Handler) Channel() chan<- *push.ChannelReq

Channel returns a channel that the server will use to send group requests to. If the adapter blocks, the message will be dropped.

func (Handler) Init

func (Handler) Init(jsonconf string) error

Init initializes the handler

func (Handler) IsReady

func (Handler) IsReady() bool

IsReady checks if the handler is initialized.

func (Handler) Push

func (Handler) Push() chan<- *push.Receipt

Push returns a channel that the server will use to send messages to. If the adapter blocks, the message will be dropped.

func (Handler) Stop

func (Handler) Stop()

Stop terminates the handler's worker and stops sending pushes.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL