public static final class PushClient.Builder

  1. Object
  2. PushClient.Builder

Configures a PushClient.

A PushListener is required. Without a custom PushTransport, the client uses the platform transport and BuildCloud registration. Supplying a custom transport bypasses BuildCloud and also requires a PushRegistrationSink so the application can maintain its own server-side subscription.

Methods

public PushClient.Builder listener(PushListener value)Sets the application listener.
public PushClient.Builder registrationSink(PushRegistrationSink value)Mirrors subscription changes to application-owned code.
public PushClient.Builder transport(PushTransport value)Replaces the managed native transport.
public PushClient build()Creates the client.

Inherited methods

Method details

listener

public PushClient.Builder listener(PushListener value)
Sets the application listener.

Parameters

value PushListener
the non-null listener retained for the life of the client

Returns

this builder

registrationSink

public PushClient.Builder registrationSink(PushRegistrationSink value)

Mirrors subscription changes to application-owned code.

For managed push this is optional and runs in addition to BuildCloud registration. For a custom transport it is required.

Parameters

value PushRegistrationSink
the registration sink, or null for managed push

Returns

this builder

transport

public PushClient.Builder transport(PushTransport value)

Replaces the managed native transport.

Setting this option prevents PushClient from contacting BuildCloud. The transport must emit schema-3 envelopes and the builder must also receive a registrationSink(PushRegistrationSink).

Parameters

value PushTransport
a custom native transport, or null to use managed platform push

Returns

this builder

build

public PushClient build()
Creates the client.

Returns

a client that must be retained and registered by the application

Throws

IllegalStateException
if no listener is configured, or if a custom transport has no registration sink