-
Notifications
You must be signed in to change notification settings - Fork 371
Description
Summary
The append parameter for the /_matrix/client/v3/pushers/set endpoint is not exposed through the SDK's Pusher::set() method or the FFI bindings. This parameter is necessary for multi-profile/multi-account support where multiple Matrix accounts on the same device need to share a single APNS/FCM push token.
Use Case
In our iOS app, we support multiple Matrix accounts logged in simultaneously. Each account needs to register for push notifications using the same device push token. Without the append: true flag, registering a pusher for one account removes the pusher for other accounts that share the same pushkey and app_id.
Current Workaround
We currently bypass the SDK and make direct HTTP calls to the Matrix API:
// We have to make direct HTTP calls because the SDK doesn't expose the append flag
let pushersSetURL = homeserverURL.appendingPathComponent("_matrix/client/v3/pushers/set")
var request = URLRequest(url: pushersSetURL)
request.httpMethod = "POST"
// ... manually construct JSON body with "append": trueTechnical Details
The append flag already exists in Ruma's PusherPostData:
pub struct PusherPostData {
pub pusher: Pusher,
pub append: bool, // Already available!
}However, the SDK's convenience method Request::post(pusher) hardcodes append: false, and neither the core SDK nor the FFI bindings expose this parameter.
Proposed Solution
Add the append parameter with a default value of false to preserve backward compatibility:
-
crates/matrix-sdk/src/pusher.rs - Add
appendparameter with default:pub async fn set(&self, pusher: Pusher, append: bool) -> Result<()> { let action = PusherAction::Post(PusherPostData { pusher, append }); self.client.send(set_pusher::v3::Request::new(action)).await?; Ok(()) }
-
bindings/matrix-sdk-ffi/src/client.rs - Add
appendto FFI with defaultfalse:pub async fn set_pusher( &self, identifiers: PusherIdentifiers, kind: PusherKind, app_display_name: String, device_display_name: String, profile_tag: Option<String>, lang: String, append: bool, // Default to false for backward compatibility ) -> Result<(), ClientError>
By defaulting append to false, this change preserves the existing behavior for all current consumers while enabling multi-account support for those who need it.
References
- Matrix spec for pushers: https://spec.matrix.org/v1.6/client-server-api/#post_matrixclientv3pushersset
- The
appendfield: "If true, the homeserver should add another pusher with the given pushkey and app id in addition to any others with different user ids."