bindPushIdentity static method
Binds incoming push invitations to the current installation and login session.
Use server-issued opaque IDs before enabling Web Push, and rotate the session ID when the signed-in account changes. Invitations for another binding are rejected.
Implementation
static Future<void> bindPushIdentity({
required String installationId,
required String sessionId,
}) async {
if (installationId.isEmpty || sessionId.isEmpty) {
throw ArgumentError('Push identity must be nonempty');
}
final response = await WebBridge.invoke({
'command': 'bindPush',
'installationId': installationId,
'sessionId': sessionId,
});
if (response['status'] != 'success') {
throw StateError('Push identity could not be bound');
}
}