public static final class PushClient.Builder
- Object
- 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
Inherited methods
Method details
listener
public PushClient.Builder listener(PushListener value)Sets the application listener.
Parameters
valuePushListener- 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
valuePushRegistrationSink- the registration sink, or
nullfor 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
valuePushTransport- a custom native transport, or
nullto 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