Class GyroPushContexts

java.lang.Object
com.iizix.server.push.api.GyroPushContexts

public final class GyroPushContexts extends Object
The IPushSessionContexts of the two gyros: the client session's posts to its client worker, the application session's to its application worker; both take the user from the application session at every call and the engine from the server. The client session's context hands over the Push Notification channel the client created under $env (P4-06), and onClientSessionCreated(ClientSessionGyro) writes the application's VAPID public key into it when the session is created and sets its receipt listener (P4-11), which reports every SHOWN and CLICKED the client sends as the session's user at report time. It writes auth too - whether the application session has an authenticated user - at creation and, through onUserAuthenticated(AppSessionGyro), when an in-app sign-in sets one later, so that the client drains the receipts it kept only once there is a user to report them for (R-10 A, INSESSION row 13). The client session's context also names the host the client used and the address it connected from, for the row a subscribe through the channel stores (P4-07). And at creation it writes the push server ID and the session's application (CC-DESIGN-PUSH-APPID-FILTER SV-4), from which the client narrows its device half's target and drains only its own receipts; a receipt is reported with the push server ID the device recorded, and the engine's events drop one naming another server (SV-5).
Author:
Christopher Mindus
  • Method Details

    • forClient

      public static IPushSessionContext forClient(ClientSessionGyro gyro)
      Creates the context of a client session.
      Parameters:
      gyro - The client session gyro.
      Returns:
      The context.
    • onClientSessionCreated

      public static void onClientSessionCreated(ClientSessionGyro gyro)
      Called when a client session is created (P4-06): when the client created a Push Notification channel under $env, the application's VAPID public key is written into it - the one thing the server writes there (PUSH-PROPS-DESIGN section 3.3), so that a later click needs no round trip. Never the private key, never the FCM service account; nothing when the server has no engine yet, the application no push configuration, or its key is not a valid P-256 point - or VAPID is not configured for it in full (the private key missing from this machine's secrets store, a pair that does not match): a key the server cannot sign with is not written, and the click answers not_configured rather than storing a row no send can reach (CC-FIX-PUSH-V5 G-3, the same check as queryAvailableTransports). The server's own * public key is written beside it, on the same conditions, so that a Browser subscribed under it inside iiziRun Developer can be stored for the application and signed with *'s pair (PUSH-CLUSTER-DESIGN 3.3, B-10b, RR-21 C). And the channel's receipt listener is set (P4-11): a SHOWN or CLICKED the client reports is handed to the engine's events as the session's user AT REPORT TIME - a user may sign in after the session was created - for every listening session of that user and application (design 7.1). With a running engine, the push server ID and the canonical application ID are written too (SV-4): the client's target and its receipt drain.
      Parameters:
      gyro - The client session gyro, its environment already received from the client.
    • onUserAuthenticated

      public static void onUserAuthenticated(AppSessionGyro app)
      Called when an application session's authenticated user is set after its creation - an in-app sign-in through AppSessionGyro.changeExternallyAuthenticatedUser (R-10 A, INSESSION row 13): every client session's channel gets auth true, and the clients drain the receipts they kept meanwhile - the tap that opened the app before the sign-in among them.
      Parameters:
      app - The application session gyro, its user set.
    • forApp

      public static IPushSessionContext forApp(AppSessionGyro gyro)
      Creates the context of an application session.
      Parameters:
      gyro - The application session gyro.
      Returns:
      The context.