public class Subscription extends Object
- The connection is made if at least one receiver subscribes. - The connection stops once the last receiver has been unsubscribed. - The subscribers will only see events (blocks) that arrive after the subscription is made.
| Modifier and Type | Class and Description |
|---|---|
static interface |
Subscription.SkipBlockReceiver
A SkipBlockReceiver will be informed on any new block arriving.
|
| Constructor and Description |
|---|
Subscription(ByzCoinRPC bc)
Starts a subscription service, but doesn't call the polling yet.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
isClosed()
Checks whether the connection is closed.
|
void |
subscribeSkipBlock(Subscription.SkipBlockReceiver br)
Subscribes the receiver to the service.
|
void |
unsubscribeSkipBlock(Subscription.SkipBlockReceiver br)
Unsubscribes an existing receiver from the system.
|
public Subscription(ByzCoinRPC bc)
bc - a reference to the instantiated ByzCoinRPCpublic void subscribeSkipBlock(Subscription.SkipBlockReceiver br) throws CothorityCommunicationException
br - the receiver that wants to be informed of new blocks.CothorityCommunicationException - is something went wrongpublic void unsubscribeSkipBlock(Subscription.SkipBlockReceiver br)
br - the receiver to unsubscribe.public boolean isClosed()
Copyright © 2019. All rights reserved.