public class TyrusNotificationService extends Object implements NotificationService, LifeCycle
Constructor and Description |
---|
TyrusNotificationService(URI uri,
IdGenerator idGenerator,
javax.websocket.ClientEndpointConfig.Configurator configurator)
Constructs a web-socket client for the given
uri . |
Modifier and Type | Method and Description |
---|---|
void |
start()
Start the client, connecting the web-socket to the server.
|
void |
stop()
Stops this object.
|
Promise<Subscription,SubscriptionException> |
subscribe(String topic,
NotificationListener listener)
Subscribes (asynchronously) to a given topic, providing a listener
that will be invoked at notification reception time.
|
public TyrusNotificationService(URI uri, IdGenerator idGenerator, javax.websocket.ClientEndpointConfig.Configurator configurator)
uri
.uri
- web-socket server endpointidGenerator
- ID Generatorconfigurator
- Web-socket client configuratorpublic void start() throws IOException, javax.websocket.DeploymentException
start
in interface LifeCycle
IOException
- if connection failedjavax.websocket.DeploymentException
- if connection failedpublic void stop()
LifeCycle
public Promise<Subscription,SubscriptionException> subscribe(String topic, NotificationListener listener)
NotificationService
subscribe
in interface NotificationService
topic
- topic name to subscribe tolistener
- notification listenerCopyright 2011-2017 ForgeRock AS.