| Summary: | NeoChat Frequent Notification Calls to Matrix Server (Dendrite) | ||
|---|---|---|---|
| Product: | [Applications] NeoChat | Reporter: | Timothy Arnold <timaeos> |
| Component: | General | Assignee: | Tobias Fella <fella> |
| Status: | CONFIRMED --- | ||
| Severity: | normal | CC: | carl |
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Flatpak | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Timothy Arnold
2023-08-04 04:13:04 UTC
Desktop clients don't usually use the push notifications API, since that requires extra infrastructure for the app maintainer (i.e., a push distributor), which is a lot of effort and not required. We do indeed probably call that API more than we'd strictly need, since that's the easiest thing for us to do. It's only being called in response to sync responses arriving at the client, which should only happen when a message arrives for your account. Looking at your log, it indicates that you received e.g. 4 messages at 23:10:20, and a bunch more in the seconds directly after - does that look plausible to you, considering how many messages you typically receive on your matrix account? otherwise this could also point to an error in dendrite, where the server sends sync responses for syncs that haven't timed out yet (In reply to Tobias Fella from comment #1) > Desktop clients don't usually use the push notifications API, since that > requires extra infrastructure for the app maintainer (i.e., a push > distributor), which is a lot of effort and not required. > > We do indeed probably call that API more than we'd strictly need, since > that's the easiest thing for us to do. It's only being called in response to > sync responses arriving at the client, which should only happen when a > message arrives for your account. Looking at your log, it indicates that you > received e.g. 4 messages at 23:10:20, and a bunch more in the seconds > directly after - does that look plausible to you, considering how many > messages you typically receive on your matrix account? otherwise this could > also point to an error in dendrite, where the server sends sync responses > for syncs that haven't timed out yet I'd say that it would be accurate during heavy periods of usage that it could line up with the activity of channels I'm in. That especially makes sense for the gaps in time frame. It does seem like that would be too frequent in my estimation if it's being called on every received message. I mention this because P2P Matrix Servers are expected to be run locally on phones and other low power devices which could become problematic down the road. (This is all a guess, though. If most of those instances are only one user, and they're not running multiple instances of NeoChat on the device, it's probably trivial) I'm still not 100% clear on the other implementations of notification systems so I'd have to ask around for the "suggested" method of handling this. I was also under the impression that the server includes the number of unread notifications in the [sync response](https://spec.matrix.org/v1.7/client-server-api/#get_matrixclientv3sync) so would the client just be able to parse that directly? I assume that NeoChat calls the sync endpoint on a regular basis. It sounds like if you set a `pusher` for the client then the server will add those to the `sync` response for that particular type of event (https://spec.matrix.org/v1.7/client-server-api/#receiving-notifications) It doesn't seem like that would require push notification infrastructure since the server would be handling the trigger of the notification and you could parse it through the sync response Ok, so not a dendrite bug then :) I wouldn't worry about the P2P part here - realistically, the overhead of the client-server syncs and the server-server API is much larger than what the notification queries would consume. Nevertheless, we probably can optimize this a bit |