Interface IAppSessionPushNotificationAPI
- All Superinterfaces:
IPushNotificationCommonAPI
- All Known Implementing Classes:
AppSessionPushAPI
The Push Notification (PN) API of one application session: the fan-out sends, and the calls that need a particular client, which take that client and delegate to its
IPushNotificationAPI.Obtained from IAppSessionGyro.getPushNotificationAPI(). Everything in IPushNotificationCommonAPI applies, in particular the threading rule: every callback runs on this application session's worker thread, including the callbacks of the delegating calls, whose client-side result is handed over from the client session's worker.
Sends from application code are trusted. The application's own server code needs no PN privilege (PUSH-WIRE-CONTRACT section 4): privileges govern the HTTP API only. What a send may reach is still bounded to this application's subscriptions.
- Author:
- Christopher Mindus
Method Summary
Modifier and TypeMethodDescriptionvoidcountSubscriptions(String topic, BiFunction<Integer, Exception, Void> callback) Counts the subscriptions of this application and topic, of every user: whatsendToTopic(String, IPushNotification, PushSendOptions, BiFunction)would match now.voidqueryDeviceState(IClientSessionGyro client, BiFunction<IPushDeviceState, Exception, Void> callback) Queries the Push Notification state of a client's device, asIPushNotificationAPI.queryDeviceState(BiFunction)does.voidresetDevice(IClientSessionGyro client, BiFunction<Integer, Exception, Void> callback) Removes every subscription of the user on a client's device for this application, asIPushNotificationAPI.resetDevice(BiFunction)does (ruled 2026-09-24, RR-15 B): other applications' rows survive.voidresetDeviceEverywhere(IClientSessionGyro client, BiFunction<Integer, Exception, Void> callback) Removes every subscription of the user on a client's device for every application, asIPushNotificationAPI.resetDeviceEverywhere(BiFunction)does (ruled 2026-09-25, P4-b): the HTTPresetwith an empty body, what iiziRun's Reset does on the server.voidsendToClient(IClientSessionGyro client, IPushNotification notification, String topic, PushSendOptions options, BiFunction<IPushSendResult, Exception, Void> callback) Sends a notification to one client's device only, asIPushNotificationAPI.sendToClient(IPushNotification, String, PushSendOptions, BiFunction)does.voidsendToTopic(String topic, IPushNotification notification, PushSendOptions options, BiFunction<IPushSendResult, Exception, Void> callback) Sends a notification to every subscriber of this application and topic, whoever they are.voidsendToUser(IPushNotification notification, String topic, PushSendOptions options, BiFunction<IPushSendResult, Exception, Void> callback) Sends a notification to the session's user on every device subscribed for this application and topic, and in-session to every connected client session of that user when the delivery mode allows it - for a topic other than the empty string, only when the user holds a subscription for it (ruled 2026-09-26, CC-PUSH-ROADMAP row 2 B).voidsendToUsers(Collection<String> recipients, IPushNotification notification, String topic, PushSendOptions options, BiFunction<IPushSendResult, Exception, Void> callback) Sends a notification to the named users on every device subscribed for this application and topic, and in-session to each named user's connected client sessions when the delivery mode allows it - for a topic other than the empty string, only when that user holds a subscription for it (ruled 2026-09-26, CC-PUSH-ROADMAP row 2 B).voidsubscribe(IClientSessionGyro client, String topic, BiFunction<IPushSubscribeResult, Exception, Void> callback) Subscribes a client's device, asIPushNotificationAPI.subscribe(String, BiFunction)does, with the same user-gesture rule: on a Browser the call succeeds only when the user has already granted notifications, and failsgesture_requiredat once otherwise - the first subscription of a Browser user comes from a click on the subscribe action (P4-09), never from a server call (ruled 2026-09-24, RR-8 A and RR-9 A) - and with the same reasons otherwise.voidunsubscribe(IClientSessionGyro client, String topic, BiFunction<Integer, Exception, Void> callback) Unsubscribes a client's device, asIPushNotificationAPI.unsubscribe(String, BiFunction)does: the row on this server first, then the device's subscription once no row of this application remains.Methods inherited from interface IPushNotificationCommonAPI
addPushNotificationListener, newMessageBuilder, queryAvailableTransports, querySubscriptions, removePushNotificationListener
Method Details
sendToUser
void sendToUser(IPushNotification notification, String topic, PushSendOptions options, BiFunction<IPushSendResult, Exception, Void> callback) Sends a notification to the session's user on every device subscribed for this application and topic, and in-session to every connected client session of that user when the delivery mode allows it - for a topic other than the empty string, only when the user holds a subscription for it (ruled 2026-09-26, CC-PUSH-ROADMAP row 2 B).- Parameters:
notification- The notification, built withIPushNotificationMessageBuilder.topic- The topic, the empty string for the application-level subscription.options- The time-to-live, urgency and delivery mode, ornullfor every default.callback- Called on the application session's worker thread with the result and its per-device outcomes, or with the failure; a session with no authenticated user fails with the reasonno_user.- Throws:
NullPointerException- Ifnotification,topicorcallbackisnull.
sendToUsers
void sendToUsers(Collection<String> recipients, IPushNotification notification, String topic, PushSendOptions options, BiFunction<IPushSendResult, Exception, Void> callback) Sends a notification to the named users on every device subscribed for this application and topic, and in-session to each named user's connected client sessions when the delivery mode allows it - for a topic other than the empty string, only when that user holds a subscription for it (ruled 2026-09-26, CC-PUSH-ROADMAP row 2 B).- Parameters:
recipients- User names or e-mail addresses, matched case-insensitively; at least one. A name that matches no user is reported as no outcome rather than as a failure. The wildcard*is not accepted here: a broadcast issendToTopic(String, IPushNotification, PushSendOptions, BiFunction), so "everyone" is never the accident of an empty or wildcard list.notification- The notification, built withIPushNotificationMessageBuilder.topic- The topic, the empty string for the application-level subscription.options- The time-to-live, urgency and delivery mode, ornullfor every default.callback- Called on the application session's worker thread with the result and its per-device outcomes, or with the failure.- Throws:
NullPointerException- Ifrecipients,notification,topicorcallbackisnull.IllegalArgumentException- Ifrecipientsis empty or contains*.
sendToTopic
void sendToTopic(String topic, IPushNotification notification, PushSendOptions options, BiFunction<IPushSendResult, Exception, Void> callback) Sends a notification to every subscriber of this application and topic, whoever they are. In-session it reaches the connected client sessions of the users subscribed to that topic; the empty string reaches every connected client session of the application, subscribed or not (ruled 2026-09-26, CC-PUSH-ROADMAP row 2 B). A session without an authenticated user is never reached by a fan-out (row 3 B);sendToClient(IClientSessionGyro, IPushNotification, String, PushSendOptions, BiFunction)is how it is reached.- Parameters:
topic- The topic, the empty string for the application-level subscribers.notification- The notification, built withIPushNotificationMessageBuilder.options- The time-to-live, urgency and delivery mode, ornullfor every default.callback- Called on the application session's worker thread with the result and its per-device outcomes, or with the failure.- Throws:
NullPointerException- Iftopic,notificationorcallbackisnull.
countSubscriptions
Counts the subscriptions of this application and topic, of every user: whatsendToTopic(String, IPushNotification, PushSendOptions, BiFunction)would match now.- Parameters:
topic- The topic, the empty string for the application-level subscriptions, ornullfor every topic.callback- Called on the application session's worker thread with the count, or with the failure.- Throws:
NullPointerException- Ifcallbackisnull.
queryDeviceState
void queryDeviceState(IClientSessionGyro client, BiFunction<IPushDeviceState, Exception, Void> callback) Queries the Push Notification state of a client's device, asIPushNotificationAPI.queryDeviceState(BiFunction)does.- Parameters:
client- A client session of this application session.callback- Called on the application session's worker thread with the state, or with the failure.- Throws:
NullPointerException- Ifclientorcallbackisnull.IllegalArgumentException- Ifclientbelongs to another application session.
subscribe
void subscribe(IClientSessionGyro client, String topic, BiFunction<IPushSubscribeResult, Exception, Void> callback) Subscribes a client's device, asIPushNotificationAPI.subscribe(String, BiFunction)does, with the same user-gesture rule: on a Browser the call succeeds only when the user has already granted notifications, and failsgesture_requiredat once otherwise - the first subscription of a Browser user comes from a click on the subscribe action (P4-09), never from a server call (ruled 2026-09-24, RR-8 A and RR-9 A) - and with the same reasons otherwise.- Parameters:
client- A client session of this application session.topic- The topic, the empty string for the application-level subscription.callback- Called on the application session's worker thread with the result, or with the failure.- Throws:
NullPointerException- Ifclient,topicorcallbackisnull.IllegalArgumentException- Ifclientbelongs to another application session.
unsubscribe
void unsubscribe(IClientSessionGyro client, String topic, BiFunction<Integer, Exception, Void> callback) Unsubscribes a client's device, asIPushNotificationAPI.unsubscribe(String, BiFunction)does: the row on this server first, then the device's subscription once no row of this application remains.- Parameters:
client- A client session of this application session.topic- The topic, the empty string for the application-level subscription.callback- Called on the application session's worker thread with the number of subscriptions removed, or with the failure.- Throws:
NullPointerException- Ifclient,topicorcallbackisnull.IllegalArgumentException- Ifclientbelongs to another application session.
resetDevice
Removes every subscription of the user on a client's device for this application, asIPushNotificationAPI.resetDevice(BiFunction)does (ruled 2026-09-24, RR-15 B): other applications' rows survive.- Parameters:
client- A client session of this application session.callback- Called on the application session's worker thread with the number of subscriptions removed, or with the failure.- Throws:
NullPointerException- Ifclientorcallbackisnull.IllegalArgumentException- Ifclientbelongs to another application session.
resetDeviceEverywhere
void resetDeviceEverywhere(IClientSessionGyro client, BiFunction<Integer, Exception, Void> callback) Removes every subscription of the user on a client's device for every application, asIPushNotificationAPI.resetDeviceEverywhere(BiFunction)does (ruled 2026-09-25, P4-b): the HTTPresetwith an empty body, what iiziRun's Reset does on the server.- Parameters:
client- A client session of this application session.callback- Called on the application session's worker thread with the number of subscriptions removed, or with the failure.- Throws:
NullPointerException- Ifclientorcallbackisnull.IllegalArgumentException- Ifclientbelongs to another application session.
sendToClient
void sendToClient(IClientSessionGyro client, IPushNotification notification, String topic, PushSendOptions options, BiFunction<IPushSendResult, Exception, Void> callback) Sends a notification to one client's device only, asIPushNotificationAPI.sendToClient(IPushNotification, String, PushSendOptions, BiFunction)does.- Parameters:
client- A client session of this application session.notification- The notification, built withIPushNotificationMessageBuilder.topic- The topic, the empty string for the application-level subscription.options- The time-to-live, urgency and delivery mode, ornullfor every default.callback- Called on the application session's worker thread with the result, or with the failure.- Throws:
NullPointerException- Ifclient,notification,topicorcallbackisnull.IllegalArgumentException- Ifclientbelongs to another application session.