Skip to content

Commit 8007b0d

Browse files
committed
push adapter documentation
1 parent 9833e20 commit 8007b0d

File tree

5 files changed

+61
-20
lines changed

5 files changed

+61
-20
lines changed

docs/API.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ _Important!_ As a security measure, the client should not send security credenti
556556

557557
## Push Notifications
558558

559-
Tinode uses compile-time adapters for handling push notifications. The server comes with [Tinode Push Gateway](), [Google FCM](https://firebase.google.com/docs/cloud-messaging/), and `stdout` adapters. Tinode Push Gateway and Google FCM support Android with [Play Services](https://developers.google.com/android/guides/overview) (may not be supported by some Chinese phones), iOS devices and all major web browsers excluding Safari. The `stdout` adapter does not actually send push notifications. It's mostly useful for debugging, testing and logging. Other types of push notifications such as [TPNS](https://intl.cloud.tencent.com/product/tpns) can be handled by writing appropriate adapters.
559+
Tinode uses compile-time adapters for handling push notifications. The server comes with [Tinode Push Gateway](../server/push/tnpg/), [Google FCM](https://firebase.google.com/docs/cloud-messaging/), and `stdout` adapters. Tinode Push Gateway and Google FCM support Android with [Play Services](https://developers.google.com/android/guides/overview) (may not be supported by some Chinese phones), iOS devices and all major web browsers excluding Safari. The `stdout` adapter does not actually send push notifications. It's mostly useful for debugging, testing and logging. Other types of push notifications such as [TPNS](https://intl.cloud.tencent.com/product/tpns) can be handled by writing appropriate adapters.
560560

561561
If you are writing a custom plugin, the notification payload is the following:
562562
```js
@@ -572,7 +572,7 @@ If you are writing a custom plugin, the notification payload is the following:
572572

573573
### Tinode Push Gateway
574574

575-
Tinode Push Gateway (TNPG) is a proprietary Tinode service which sends push notifications on behalf of Tinode. It uses Google FCM on the backend and as such supports the same platforms as FCM. The main advantage of using TNPG over FCM is simplicity of configuration: mobile clients do not need to be recompiled, all is needed is a configuration update on a server.
575+
Tinode Push Gateway (TNPG) is a proprietary Tinode service which sends push notifications on behalf of Tinode. 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 do not need to be recompiled, all is needed is a [configuration update](../server/push/tnpg/) on a server.
576576

577577
### Google FCM
578578

docs/faq.md

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,9 @@ Alternatively, you can instruct the docker container to save the logs to a direc
2222

2323
### Q: How to setup push notifications with Tinode Push Gateway?<br/>
2424
**A**: Enabling TNPG push notifications requires two steps:
25-
* register at console.tinode.co and obtain a TNPG token
26-
* configure server with the token
27-
28-
#### Obtain TNPG token
29-
1. Register at https://console.tinode.co and create an organization.
30-
2. Get the TPNG token from the _On premise_ section by following the instructions there.
31-
32-
#### Configuring the server
33-
34-
Update the server config [`tinode.conf`](../server/tinode.conf#L384), section `"push"` -> `"name": "tnpg"`:
35-
```js
36-
{
37-
"enabled": true,
38-
"org": "test", // name of the organization you registered at console.tinode.co
39-
"token": "SoMe_LonG.RaNDoM-StRiNg.123" // authentication token obtained from console.tinode.co
40-
}
41-
```
42-
Make sure the `fcm` section is disabled `"enabled": false`.
25+
* register at console.tinode.co and obtain a TNPG token.
26+
* configure server with the token.
27+
See detailed instructions [here](../server/push/tnpg/).
4328

4429

4530
### Q: How to setup push notifications with Google FCM?<br/>

server/push/fcm/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# FCM push adapter
2+
3+
This adapter sends push notifications to mobile clients and web browsers using [Google FCM](https://firebase.google.com/docs/cloud-messaging/). As of the time of this writing it supports Android with [Play Services](https://developers.google.com/android/guides/overview), iOS devices, and all major web browsers [excluding Safari](https://caniuse.com/#feat=push-api).
4+
5+
This adapter requires you to obtain your own credentials from Goole Firebase. If you want to use iOS and Android mobile apps with your service, they must be recompiled with your credentials obtained from Google. If you do not want to recompile mobile clients, consider using TNPG adapter instead.
6+
7+
8+
## Configuring FCM adapter
9+
10+
### Server and TinodeWeb
11+
12+
1. Create a project at https://firebase.google.com/ if you have not done so already.
13+
2. Follow instructions at https://cloud.google.com/iam/docs/creating-managing-service-account-keys to download the credentials file.
14+
3. Update the server config [`tinode.conf`](../server/tinode.conf#L255), section `"push"` -> `"name": "fcm"`. Do _ONE_ of the following:
15+
* _Either_ enter the path to the downloaded credentials file into `"credentials_file"`.
16+
* _OR_ copy the file contents to `"credentials"`.<br/><br/>
17+
Remove the other entry. I.e. if you have updated `"credentials_file"`, remove `"credentials"` and vice versa.
18+
4. Update [TinodeWeb](/tinode/webapp/) config [`firebase-init.js`](https://github.com/tinode/webapp/blob/master/firebase-init.js): update `apiKey`, `messagingSenderId`, `projectId`, `appId`, `messagingVapidKey`. See more info at https://github.com/tinode/webapp/#push_notifications
19+
20+
### iOS and Android
21+
22+
1. If you are using an Android client, add `google-services.json` to [Tindroid](/tinode/tindroid/) by following instructions at https://developers.google.com/android/guides/google-services-plugin and recompile the client. You may also optionally submit it to Google Play Store.
23+
See more info at https://github.com/tinode/tindroid/#push_notifications
24+
2. If you are using an iOS client, add `GoogleService-Info.plist` to [Tinodios](/tinode/ios/) by following instructions at https://firebase.google.com/docs/cloud-messaging/ios/client) and recompile the client. You may optionally submit the app to Apple AppStore.
25+
See more info at https://github.com/tinode/ios/#push_notifications

server/push/stdout/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# `stdout` push adapter
2+
3+
This is an adapter which logs push notifications to `STDOUT` where they can be redirected to file or processed by some other service.
4+
This adapter is primarily intended for debugging and logging.

server/push/tnpg/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# TNPG: Push Gateway
2+
3+
This is push notifications adapter which communicates with Tinode Push Gateway (TNPG).
4+
5+
TNPG is a proprietary service intended to simplify deployment of on-premise installations.
6+
Deploying a Tinode server without TNPG requires [configuring Google FCM](../fcm/) with your own credentials including recompiling mobile clients and releasing them to PlayStore and AppStore under your own accounts which is usually time consuming and relatively complex.
7+
8+
TNPG solves this problem by allowing you to send push notifications on behalf of Tinode. 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 do not need to be recompiled, all is needed is a configuration update on the server.
9+
10+
## Configuring TNPG adapter
11+
12+
### Obtain TNPG token
13+
14+
1. Register at https://console.tinode.co and create an organization.
15+
2. Get the TPNG token from the _On premise_ section by following the instructions there.
16+
17+
### Configuring the server
18+
19+
Update the server config [`tinode.conf`](../server/tinode.conf#L384), section `"push"` -> `"name": "tnpg"`:
20+
```js
21+
{
22+
"enabled": true,
23+
"org": "myorg", // name of the organization you registered at console.tinode.co
24+
"token": "SoMe_LonG.RaNDoM-StRiNg.12345" // authentication token obtained from console.tinode.co
25+
}
26+
```
27+
Make sure the `fcm` section is disabled `"enabled": false`.

0 commit comments

Comments
 (0)