RocketChat / Rocket.Chat.Cordova

Rocket.Chat Cross-Platform Mobile Application via Cordova (DEPRECATED)
MIT License
104 stars 109 forks source link

[sandstorm] notifications not working #183

Open rawwerks opened 7 years ago

rawwerks commented 7 years ago

i guess i originally had this issue in the wrong repo...here we go:

we finally got rocket chat working on mobile with sandstorm, but the only problem is that the notifications are not working for anyone on our team.

server logs have a whole lot of this: app.js:401 [31mSystem ➔ error Error sending push to gateway (3 try) -> { [Error: tunneling socket could not be established, cause=Parse Error] code: 'ECONNRESET' }

push gateway was: https://gateway.rocket.chat, the default. test pushes show 'successfully pushed to 1 device' on the admin panel, but the pushes never come through and the logs show the error above. (i also tried https://rocket.chat as the gateway to no avail, referencing https://github.com/RocketChat/Rocket.Chat/issues/4527)

geekgonecrazy commented 7 years ago

@rawwerks so this is a limitation of sandstorm. From my understanding all communications have to go through sandstorm. Its part of the whole security and isolation model. So any outbound connection like this and url previews do not currently work on sandstorm.

rawwerks commented 7 years ago

@kentonv?

rawwerks commented 7 years ago

@geekgonecrazy - i don't think it is a fundamental limitation of sandstorm, because browser and desktop notifications work just fine for us. it is just the mobile app we're having trouble with pushing notifications.

geekgonecrazy commented 7 years ago

@rawwerks mobile notifications and desktop notifications work much, much differently.

Desktop notifications are delivered to you via a websocket. Then once in the browser the browser fires the desktop notification.

The connection to the server is blessed by sandstorm to you as the client.

Mobile notifications happen server side. They open a brand-new connection to gateway.rocket.chat which then fires off notifications to apple for iOS and Google for Android. It's the sandbox server side that keeps connections from going out that prevents notifications on mobile.

kentonv commented 7 years ago

Yeah, push notifications don't work at all in Sandstorm at present since the app won't have permission to talk to gateway.rocket.chat. One of the following needs to happen:

Unfortunately, I don't think anyone is actively working on either of these at present.

geekgonecrazy commented 7 years ago

@kentonv thanks for taking the time to reply. Seems like the first option is probably the easiest. Albeit not the most secure. But in this case push notifications leave the confines of the box either way.

We'll take a look at that option. Looks like it'll potentially require some refactoring in the push notification logic. But shouldn't be too difficult.

rawwerks commented 7 years ago

@geekgonecrazy - we would greatly appreciate if you could look into the 1st option...it would make a huge difference to my team (and i imagine many others)

urakagi commented 7 years ago

Hello, is there any progress there? We're evaluating using Rocket Chat instead of Slack, and is interesting if push notifications can work.

urakagi commented 7 years ago

I have experience of Powerbox, but I don't know where notification codes locate. Or maybe @geekgonecrazy can you tell me where should I modify, so I can code it and make a pull request? Thanks!

kentonv commented 7 years ago

@urakagi Since Rocket.Chat already integrates with Sandstorm's notifications API, probably the best thing would be if Sandstorm could be extended to support push notifications, rather than have Rocket.Chat make powerbox requests. If someone wanted to work on this on the Sandstorm side, they could probably follow the existing code for desktop notifications (grep for [Dd]esktopNotification) to see where to hook in. I don't know much about how push notifications work, though, so I don't know what else is involved...