i want to host my own push notification gateway ?
i dont know from where to start or what gateway to selfhost
any help ???
From the docs
- Go to “Administration”, then “Push”
- Set the Enable Gateway to False, then you will use your own Rocket.Chat as gateway instead of the https://rocket.chat server
- Restart server
Now you should be able to Send a test message. Make sure that you have logged in to the server once, and then closed the app. You should see a test notitication after you pressed the send button.
@AmShaegar13
So Rocket.Chat server has it's own gateway so if i implement the server on my own and set push to false, then now i have my own gateway push server ??
im confused -_- am i understand it right ??
That's how I understand it, yes. I assumed you already have your own instance of RocketChat running. If that's not the case you probably should explain your setup and what you want to achieve a bit more.
The gateway is only needed if you would like to use our official apps from the app store. This is the only way we are able to deliver your push notifications to the app.
If you do not want to use our push gateway then you will need to compile your own apps. You don't need a gateway in that case though... you just need to build the apps with the GCM and Apple push information and then set inside of Rocket.Chat
But in no case should you need a push gateway. This is simply a feature to allow us to deliver push notifications to you when you use our official apps.
@geekgonecrazy, can you elaborate a bit more about what travels through Rocket.Chat gateways?
I think that most people that self-host their server are interested in maintaining privacy control of the messages exchanged on their RC instances, and it is not clear what actually goes back and forth between self-hosted instances and the RC gateway WRT notifications.
More specifically, are message contents sent to RC servers upon notifications? What exactly is sent to RC server?
Any insight will be appreciated.
_[Edit: opened a new issue to track this: #9027]_
@arminfelder is working on a push gateway. We need it for our fairchat app, which allows to connect to any RocketChat server, but we can't share private keys for GCM.
as @rasos pointed out, I wrote a small pushgateway for RocketChat, please feel free to give me feedback: https://git.fairkom.net/chat/RocketChatMobilePushGateway
To confirm the instructions here do not work for Google Play Store apps and you have to use the gateway?
https://rocket.chat/docs/administrator-guides/notifications/push-notifications/
@caesarcxiv the android application is registering it self with Google Firebase Messaging(formally GCM), by using given credentials, built into the app, the app then sends the received push token to the Rocket.Chat Server you are connected to. The RC server then send notifications using the API key, which is related to the key the app is using, together with the token as recipent to google, which is then sending it to the mobile.
If you have your own RC server and want to use the Rocket.Chat cordova app, you would need to configure your server to forward the notifications to the app developers, as they are the only ones, who are able to send push messages to their app. This is done by setting the push gateway.
If you develop your own app or just build it yourself, you have to set your credentials from Google Firebase to your server.
If you develop your own app, and want other servers to be able to use it, with push, then you need to setup your own gateway, which then has to be used by the other servers..., in that case you can use my small gateway server: https://git.fairkom.net/chat/RocketChatMobilePushGateway
Hi @arminfelder, I'm testing out your gateway server https://git.fairkom.net/chat/RocketChatMobilePushGateway but having blocking issues.
I'm receiving a stdout log from the executable rocketChatMobilePushGateway
like this:
<!DOCTYPE html>
<html lang=en>
<meta charset=utf-8>
<meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
<title>Error 411 (Length Required)!!1</title>
<style>
*{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}
</style>
<a href=//www.google.com/><span id=logo aria-label=Google></span></a>
<p><b>411.</b> <ins>That’s an error.</ins>
<p>POST requests require a <code>Content-length</code> header. <ins>That’s all we know.</ins>
Finished, total:1, success:1,failed:0.
Finished, total:1, success:1,failed:0.
Finished, total:1, success:1,failed:0.
I'm compiling the push gateway from source and expose the port 11000 to 80 via Nginx reversed proxy. Unsure if my Nginx reversed proxy config is correct but Content-length header is missing when reaching Google GCM server.
I'm no C++ coder, so just checking with you if your RocketChatMobilePushGateway already pass the Content-length header. I'll keep checking my Nginx config at my side.
@trongthanh I just created a branch "debug", with some additional debug information.
For me it looks like there is no data attached at all, because, libcurl is setting the content-length automatically, please check your serverKey.txt file
OK, I'll do another round of tests tomorrow. Thanks.
Hi @arminfelder,
Here's the dump of the log from the new debug build:
== Info: Trying 74.125.68.95...
== Info:Connected to fcm.googleapis.com (74.125.68.95) port 443 (#0)
== Info:ALPN, offering http/1.1
== Info:Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
== Info:successfully set certificate verify locations:
== Info: CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: /etc/ssl/certs
== Info:TLSv1.2 (OUT), TLS header, Certificate Status (22):
=> Send SSL data:
== Info:TLSv1.2 (OUT), TLS handshake, Client hello (1):
=> Send SSL data:
<= Recv SSL data:
== Info:TLSv1.2 (IN), TLS handshake, Server hello (2):
<= Recv SSL data:
<= Recv SSL data:��
== Info:TLSv1.2 (IN), TLS handshake, Certificate (11):
<= Recv SSL data:
<= Recv SSL data:
== Info:TLSv1.2 (IN), TLS handshake, Server key exchange (12):
<= Recv SSL data:
<= Recv SSL data:
== Info:TLSv1.2 (IN), TLS handshake, Server finished (14):
<= Recv SSL data:
=> Send SSL data:
== Info:TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
=> Send SSL data:
=> Send SSL data:
== Info:TLSv1.2 (OUT), TLS change cipher, Client hello (1):
=> Send SSL data:
=> Send SSL data:
== Info:TLSv1.2 (OUT), TLS handshake, Finished (20):
=> Send SSL data:
<= Recv SSL data:
== Info:TLSv1.2 (IN), TLS change cipher, Client hello (1):
<= Recv SSL data: ��u�NV^%ۙ�(���&�J��
|.�uDf���
<= Recv SSL data:
== Info:TLSv1.2 (IN), TLS handshake, Finished (20):
<= Recv SSL data:
== Info:SSL connection using TLSv1.2 / ECDHE-ECDSA-AES128-GCM-SHA256
== Info:ALPN, server accepted to use http/1.1
== Info:Server certificate:
== Info: subject: C=US; ST=California; L=Mountain View; O=Google Inc; CN=*.googleapis.com
== Info: start date: Mar 28 14:43:35 2018 GMT
== Info: expire date: Jun 20 13:25:00 2018 GMT
== Info: subjectAltName: fcm.googleapis.com matched
== Info: issuer: C=US; O=Google Trust Services; CN=Google Internet Authority G3
== Info: SSL certificate verify ok.
=> Send SSL data: '��u���8��y�7��
>�4@?D(�����l��b^|�?�Ng�q�q����xKyT�2M�8y����������j]�m�5�
=> Send header: POST /fcm/send HTTP/1.1
Host: fcm.googleapis.com
Accept: */*
Authorization: key=AAAAp11CKWQ:APA91bEhyaP-gZkF_yJnH8i3zmwCjnHncmOKjZtNBk5b09ykO7TfQZt6eDxXUzQa9h9LQKFAX2_WdDpiFIEB0x4eP-2ka-_v8kqEPrw72cv9YfJ1zwWOn6sJnVlnEcOOAhKwKgkOgRjF
Content-Type: application/json
Content-Length: 454
{"notification":{"body":"hello","ejson":"{\"host\":\"https://demo.goalify.chat/\",\"name\":null,\"rid\":\"96YdHmd6jcmjhbRvk96YdHmd6jcmjhbRvk\",\"sender\":{\"_id\":\"96YdHmd6jcmjhbRvk\",\"name\":\"Thanh Tran\",\"username\":\"thanh\"},\"type\":\"d\"}\n","message":"","msgcnt":0,"title":"thanh"},"to":"c4d6cSoRWMk:APA91bHDvuOgdgN1-cQ1h4Q-8yBWNACRy2ZZhHkeXvpjUukuDyH30kBMaEmIVjKA5hBI7wS1PWWilOv8TiCvFbt2asYeTwrjlPWi8XBnH-aIBKYW4p7N_ucqVumIH_-FgjuMyeo8mAW7"}
=> Send data: {"notification":{"body":"hello","ejson":"{\"host\":\"https://demo.goalify.chat/\",\"name\":null,\"rid\":\"96YdHmd6jcmjhbRvk96YdHmd6jcmjhbRvk\",\"sender\":{\"_id\":\"96YdHmd6jcmjhbRvk\",\"name\":\"Thanh Tran\",\"username\":\"thanh\"},\"type\":\"d\"}\n","message":"","msgcnt":0,"title":"thanh"},"to":"c4d6cSoRWMk:APA91bHDvuOgdgN1-cQ1h4Q-8yBWNACRy2ZZhHkeXvpjUukuDyH30kBMaEmIVjKA5hBI7wS1PWWilOv8TiCvFbt2asYeTwrjlPWi8XBnH-aIBKYW4p7N_ucqVumIH_-FgjuMyeo8mAW7"}
== Info:upload completely sent off: 454 out of 454 bytes
<= Recv SSL data: �
== Info:HTTP 1.0, assume close after body
<= Recv header: HTTP/1.0 411 Length Required
<= Recv header: Content-Type: text/html; charset=UTF-8
<= Recv header: Referrer-Policy: no-referrer
<= Recv header: Content-Length: 1564
<= Recv header: Date: Tue, 17 Apr 2018 03:50:14 GMT
<= Recv header:
<!DOCTYPE html>
<html lang=en>
<meta charset=utf-8>
<meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
<title>Error 411 (Length Required)!!1</title>
<style>
*{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x
<= Recv data: <!DOCTYPE html>
<html lang=en>
<meta charset=utf-8>
<meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
<title>Error 411 (Length Required)!!1</title>
<style>
*{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x
<!DOCTYPE html>
<html lang=en>
<meta charset=utf-8>
<meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
<title>Error 411 (Length Required)!!1</title>
<style>
*{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x<= Recv SSL data: h
<= Recv data: 54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}
</style>
<a href=//www.google.com/><span id=logo aria-label=Google></span></a>
<p><b>411.</b> <ins>That’s an error.</ins>
<p>POST requests require a <code>Content-length</code> header. <ins>That’s all we know.</ins>
54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}
</style>
<a href=//www.google.com/><span id=logo aria-label=Google></span></a>
<p><b>411.</b> <ins>That’s an error.</ins>
<p>POST requests require a <code>Content-length</code> header. <ins>That’s all we know.</ins>
== Info:Closing connection 0
BTW, I was a bit confused about the content of the serverKey.txt. I just placed the content of GCM API Key in there, is it correct?
@trongthanh I have fixed the issue, it was related to your newline char at the end of the google key, which did destroy the http header, I added a line to remove all n from the key after reading it into memory.
the key you need is the one called "Server key":
https://console.firebase.google.com/project -> your app -> Project Settings -> Cloud Messaging -> Server key
I think the GCM key should also work, but its legacy...
p.s I also switched on compiler optimizations, now it should run fine with about 1MB of RAM :)
@arminfelder Thanks for your quick response. We're making really good progress.
For me, the GCM / FCM push is working now though there is no proper icon, thumbnail for the notification. Maybe I have to fix it in the GooglePushModel.cpp, right now only title
and body
and a non-related ejson
are in the notification object.
Besides, I was too focus on the GCM issue that I didn't notice that push notification doesn't work for Apple / iOS devices either. When I try obmitting /certs/apple/cred.pem
file, the executable start just fine. So maybe Apple push is not active?
BTW, when I try to install the Ubuntu package: libcurlpp0-dev
as instructed in your README, the package was not found, so I installed libcurl4-openssl-dev
which is available for Ubuntu 16.04 LTS instead.
@trongthanh I used ubuntu 17.10 on my dev computer, and debian stretch for the Docker image,
I build the gateway to fit my needs for my FairChat app, if you need additions to the pushmessage json, just write me how it should look like, or make a merge request on our gitlab(sign in is possible with github account)
@trongthanh there is a small bug in @arminfelder's gateway affecting iOS push messages, I've created an issue about it and fixed it in this fork https://github.com/q210/RocketChatMobilePushGateway (also fixed Docker file, it can be built now)
Hi Everyone, I also needed a self-hosted push gateway but I didn't want to hassle with FCM, so I went on another route. My simple gateway implementation is in Python, uses Apprise to connect to Gotify (or other notification providers), runs in Docker, and it's easy to setup with docker-compose. For a few users, it provides a viable alternative instead of using gateway.rocket.chat and the Google ecosystem. If you're interested, give it a try :) https://github.com/immanuelfodor/rocketchat-push-gateway
Important to remind that doing this does require building the mobile apps and getting them distributed to your users
Since my solution uses a separate app (e.g. Gotify) to receive the push notifications, you can use the official RC app. The Gotify mobile app uses websockets to get the push messages, and even with excluding it from battery optimization, it doesn't show up in battery usage, no drain or whatsoever for me on Android Pie.
True! That's a really cool solution to avoid GCM/FCM thanks for sharing! Looks kinda like ownpush that we've talked to in the past, but looks like gotify started off with all of their source published 👍
Might be worth posting in community creations on forum. Though be sure to point out its for Android only :) I'm sure others would find this really cool
For sure that's cool !
Maybe a silly question, but if Gotify mobile app ("simply") uses websockets to get the push messages why Rocket.chat cannot do the same as the Rocket.chat server already support WS ?
I guess that's not easy to code in Rocket mobile client.
It’s not that we can’t. But imagine if all of your apps did this. Your battery would be toast. If you have just one service like fcm or gotify running then it’s not bad
True! That's a really cool solution to avoid GCM/FCM thanks for sharing! Looks kinda like ownpush that we've talked to in the past, but looks like gotify started off with all of their source published
Might be worth posting in community creations on forum. Though be sure to point out its for Android only :) I'm sure others would find this really cool
Thanks for the kind words! I'm not on the forum, so you can (or please) share it for the benefit of others. If it boosts you community points, karma or whatever, it's a free gift :D
It’s not that we can’t. But imagine if all of your apps did this. Your battery would be toast. If you have just one service like fcm or gotify running then it’s not bad
You're right.
But my need is only for "the ultimate team chat software solution", Rocket.chat ;)
For large organization :
I remember some kind of popup with Riot that ask me if I want to "toast my battery or not". Matrix uses FCM or long-polling in my memories.
Wow, it would be great to have a switch in the app that we only need to flick, and it uses websockets then without any gateway or so. If you don't want the app to be killed by Android, we could just remove it from battery optimizatin just as I did with Gotify. RocketChat can be selfhosted, why use another service when we have everything we need in place? In this context, the whole gateway idea seems like a workaround. I highly support the built-in "alternative" notification idea, it can have a benefit on the privacy side as well (before Gotify, I used to turn off displaying message content for messages going through the official gateway and FCM).
I need gateway‘s standard, it is there?
@teko44 We had used a push notifications gateway called: Cloud Alert Messaging Gateway. The Gateway is free to download and they also have a free plan where you can send Unlimited free messages for upto 500 unique devices per month.
In our recent project we had basically used their APIs to integrate with our application and database and notifications were pushed to our customers on event-based actions. We were also able to easily integrate notifications in our android and iOS mobile apps, through their SDK. I think you should give them a try.
The other interesting fact was that their notifications gateway had so many features.
I need gateway‘s standard, it is there?
I don't think there is any documentation out there, but you could either watch the packages, or look into the code or Rocketchat or one of the community wirtten gateways mentioned here like:
https://github.com/arminfelder/RocketChatMobilePushGateway
https://github.com/immanuelfodor/rocketchat-push-gateway
Please - this Issue is closed.
Read he documentation here:
https://rocket.chat/docs/administrator-guides/notifications/push-notifications/
Ask questions in the forums or open.rocket.chat
Wait, is there any way we can change this gateway? http://prntscr.com/ptih0c
What push notification gateways we can use for that value? Without using a self-configured push notification. Please help! Thanks.
Please help! Thanks.
Please read my previous comment. Stop asking here as you will get no help here.
Ask questions in the forums or open.rocket.chat
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Most helpful comment
@geekgonecrazy, can you elaborate a bit more about what travels through Rocket.Chat gateways?
I think that most people that self-host their server are interested in maintaining privacy control of the messages exchanged on their RC instances, and it is not clear what actually goes back and forth between self-hosted instances and the RC gateway WRT notifications.
More specifically, are message contents sent to RC servers upon notifications? What exactly is sent to RC server?
Any insight will be appreciated.
_[Edit: opened a new issue to track this: #9027]_