MSC4320: Rich Presence - #4320
Conversation
There was a problem hiding this comment.
Implementation requirements:
- Matrix client receiving activity data and sending it to the homeserver
- External app sending activity data to the local Matrix client
|
could be turned on or off from people who dont want it |
|
Implemented rendering rich presences in Extera Next latest commit |
| - `player` containing the media player. | ||
| - `streaming_link` containing a link to the song on streaming services (i.e. Spotify, YouTube). Clients should warn the user before opening the link. | ||
|
|
||
| Optional fields if `type` is `m.rpc.activity`: |
There was a problem hiding this comment.
Maybe including a timestamp start_time and expire_time, if a user goes offline without clearing their status, the expire_time could be used to not render the activity
|
maybe communication with webclients can be done using iframes? like element does with widgets... |
| Discord, a popular instant messenger, has a feature where alongside normal presence (ie online/away/busy/offline, status messages) there can be current activities. For example, music shows album art, song name, artist and current song progress, games show the map and such, etc. | ||
| # Proposal | ||
| ### Data transport | ||
| JSON data will be sent over a websocket running on `http://localhost:{TBD}/rpc`. This will be easiest for native clients, web clients will require something running on the host. Clients will send data to the server via a `PUT` to `/_matrix/client/v3/profile/{userId}/m.rpc` with content explained in "data content". Servers should preform basic validation on `m.rpc` to ensure only the needed fields are included. After an activity is closed or a song is paused/stopped, a`DELETE` should be sent to `_matrix/client/v3/profile/{userId}/m.rpc`. Note that skipping a track should not delete the RPC, as long as there's music playing. In that event, the `m.rpc` field should just be updated. |
There was a problem hiding this comment.
We should avoid allocating a port for this, as there is no guarantee that a given port isn't taken - Discord for example uses /run/user/$UID/discord-ipc-N (where N is a number from 0 to 9, taking the lowest available value)
| } | ||
| ``` | ||
| ### Potential implementations | ||
| - Something using [arRPC](https://arrpc.openasar.dev/) to pretend to be Discord to get info. |
There was a problem hiding this comment.
This relies on automating a Discord user account to obtain application info (ie. resolving an application ID to it's name and other info) - this isn't available to bots as far as I'm aware.
| ### Data transport | ||
| JSON data will be sent over a websocket running on `http://localhost:{TBD}/rpc`. This will be easiest for native clients, web clients will require something running on the host. Clients will send data to the server via a `PUT` to `/_matrix/client/v3/profile/{userId}/m.rpc` with content explained in "data content". Servers should preform basic validation on `m.rpc` to ensure only the needed fields are included. After an activity is closed or a song is paused/stopped, a`DELETE` should be sent to `_matrix/client/v3/profile/{userId}/m.rpc`. Note that skipping a track should not delete the RPC, as long as there's music playing. In that event, the `m.rpc` field should just be updated. | ||
| ### Data federation | ||
| `m.rpc` data will be federated over a `GET` to `/_matrix/client/v3/profile/{userId}/m.rpc`, as per [MSC4133](https://github.com/matrix-org/matrix-spec-proposals/pull/4133). |
There was a problem hiding this comment.
Concern: what about homeservers/clients that enforce long TTLs on profile caching? (ie. 15 minutes doesn't seem unreasonable whatsoever, which would be eg. about 5x the length of an average song)


Rendered