This lightweight push gateway is designed for Rocket.Chat servers. It enables push notifications for mobile devices.
- Mobile apps register with Google Firebase Messaging (formerly GCM) or Apple APNS using built-in credentials.
- The app sends the received push token to the connected Rocket.Chat server.
- The Rocket.Chat server uses the API credentials and push token to transmit notifications via Google Firebase or Apple APNS.
- Google or Apple forwards the push notifications to the mobile device.
- If deploying your own Rocket.Chat server with the Rocket.Chat Cordova app, configure your server to forward notifications to app developers who can send push messages.
- For custom-built apps, configure your own credentials (Google Firebase/Apple APNS) on the server. Other servers can use this gateway for push notifications.
Make sure the following are installed before building:
libjsoncpp-dev
cmake
git
zlib1g-dev
openssl
,libssl-dev
uuid-dev
libgflags-dev
-
CMake Build:
- Clone the repository recursively:
git clone --recurse-submodules <repository_url>
- Run:
cmake . make
- Clone the repository recursively:
-
Set Credentials:
-
Environment Variables:
FCM_SERVICE_ACCOUNT_JSON
APNS_PRIVATE_KEY
(PEM format):- Create a key following Apple's Guide.
- Convert the
.p8
file to PEM format and encode base64: e.g.openssl pkcs8 -nocrypt -in key.p8 -out key.pem cat key.pem | base64 -w0
- Additional:
APNS_TEAM_ID
APNS_KEY
APNS_APPID
-
Credentials Directory:
credentials/google/serviceAccount.json credentials/apple/key.pem credentials/apple/setting.json
Example
setting.json
:{ "teamId": "YOUR_APPLE_DEVELOPER_TEAM_ID", "key": "AUTHKEY_IDENTIFIER", "appId": "YOUR_APP_BUNDLE_ID" }
-
-
Optional - Forward Gateway:
- Enable chaining (supports custom + official apps):
FORWARD_GATEWAY_ENABLE=TRUE FORWARD_GATEWAY_URL=https://gateway.rocket.chat # Optional
- Enable chaining (supports custom + official apps):
- Build the Docker container:
docker build .
- Mount the credentials' folder:
Folder structure:
docker run -t gateway -v /yourCertsFolder:/certs -p 80:11000 <image_id>
/yourCertsFolder/google/serverKey.txt /yourCertsFolder/apple/key.pem
Adapt the example files in ./k8s
to suit your deployment requirements.