tinode / webapp

Tinode web chat using React
Apache License 2.0
322 stars 197 forks source link

Notifications can't be activated after fresh installed tinode & mysql db #25

Closed pwFoo closed 5 years ago

pwFoo commented 5 years ago

webapp works fine with desktop browsers. After a reinstall of tinode docker container I have some problems with notifications with Chrome for Android Browser.

I cleared cache to reset notifications, but can't subscribe in tinode webapp settings. Checkbox can't be checked and no reaction. Worked until I reinstalled tinode with a fresh mysql database. Registered new user. All and also webpush notifications are fine with desktop and another test android phone (Chrome too).

But my own phone will not subscribe to notifications again...

Any idea if that could be a bug and how to debug webapp notifications with android phone / mobile chrome? Sounds like the same problem as a fried has with it. He never get webpush notifications work. He has an old phone (Android 6), I have a One Plus 5 with Android 8.1.

or-else commented 5 years ago

Checkbox can't be checked and no reaction.

That means either firebase is not properly initialized or you are running the client over http rather than https.

Please show client-side and server-side logs.

pwFoo commented 5 years ago

Firebase works fine! Enable notifications and receive webpush notifications work fine with opera, chrome (desktop) and a test phone, but not able to subscribe / receive notifications with my one+...

Tested today and I was able to enable! Without a change!

So I think it was a problem with service-worker update / caching problem after tinode version update. I tried to delete all website data some times (clear cache, reset permissions, ...), but still that problem until today. Service-worker cache is 1 day I think? So should be the problem...

Would it possible to implement a update detection and a button to trigger a clean update from client side? Something like "Update available, click here to install and reload". That should replace the current service-worker with the new one and remove invalid cached data?

or-else commented 5 years ago

Please show client-side and server-side logs.

or-else commented 5 years ago

Would it possible to implement a update detection and a button to trigger a clean update from client side? Something like "Update available, click here to install and reload".

It's been done a while ago https://github.com/tinode/chat/releases/tag/v0.15.9

pwFoo commented 5 years ago

There was no update notification, I think it was updated automatically, but looks like service worker wasn't sucessful updated / (forced) reloaded? Because it works 10 hours later without change anything and worked fine with other devices without wait some hours.

Have to take a look how remote debugging works. https://developers.google.com/web/tools/chrome-devtools/remote-debugging/?utm_source=dcc&utm_medium=redirect&utm_campaign=2016q3

or-else commented 5 years ago

There was no update on this issue for a while. Is it still relevant?

pwFoo commented 5 years ago

Updated my setup with DB reset to latest stable two days ago and notifications can't bei enabled with Chrome Desktop and Chrome for Android. After delete cache and reset permissions I still can't activate notifications in the settings. I have to check the logs again.

or-else commented 5 years ago

Any update on this?

pwFoo commented 5 years ago

Hi @or-else I have to install it again. Waiting for the latest rc (at the moment not available at docker hub) for deployment.

pwFoo commented 5 years ago

Still can't activate notifications. Updated to latest with same problem. docker run command is unchanged and should be fine with FCM config. So looks like tinode internals about notifications changed some releases ago?

Don't like the FCM solution. Should be much more flexible and simpler with vendor dependent notifications (#128), because no need to setup a account / fcm configuration. It works out of the box client / server side.

or-else commented 5 years ago

Please show client- and server-side logs

Don't like the FCM solution.

I don't see why. In case of using native methods they have to be integrated for every platform separately then have to be set up separately. FCM requires just one integration + multiple setups. Native require multiple integrations + multiple setups. And FCM has to be integrated anyway because it's native for Android (and works better than native APNS for iOS, APNS is buggy).

or-else commented 5 years ago

Keep in mind that notifications work just fine at https://api.tinode.co/ Whatever problems you have are likely to be related to your specific setup.

pwFoo commented 5 years ago

With native solution you don't need to create or configure a account! Just a generated key to verify your server. No need for a web push (FCM, Mozilla, Microsoft) account.

Minimal configuration server side, no configuration client side.

or-else commented 5 years ago

With native solution you don't need to create or configure a account!

That's not true. Both Apple and Google require account registration for pushes on their platforms. Apple even requires $100.

pwFoo commented 5 years ago

I'm sure I built my test without account registration or cost!

Take a look into: https://webpushdemo.azurewebsites.net/

It works as described there:

We’ll need to specify the VAPID keys that will allow identifications between our app’s server and the notification server (e.g. Firebase Cloud Messaging (FCM), Mozilla Cloud Services (MCS), and Windows Push Notification Service (WNS) depending on which browser is being used). You only need to set up the VAPID keys once which can be generated easily:

Device register at Push Notification Service (FCM, WNS, MCS). identification / verification looks like just public / private key. Client use the servers (=tinode) key during registration. Server send messages to Service Server with the key to identify / auth to send push to the client.

I tested it successful so I would know if I created or configured an account...

pwFoo commented 5 years ago

Server side just use a web push lib. Client side is simple code as shown in the demo.

or-else commented 5 years ago

Please correct me if I'm wrong but your service is browser-only.

pwFoo commented 5 years ago

The example is browser based example, yes. Don't know how it would be possible with an app?! Haven't thought about that because I prefer fullscreen (app mode, "add to homescreen") web applications running in the browser (for example Chrome).

So with apps you could be right about cost and needed account. Haven't looked into app development / frameworks...

or-else commented 5 years ago

The current push functionality in Tinode supports all major browsers (except Safari), native Android and native iOS apps.

or-else commented 5 years ago

This seems to be either outdated or no longer relevant.