Receiving WebSocket Events

Realtime event triggering is trending in modern application development. It helps application to always be up to date and so provides better user experiences. Bitmark SDK offers Web Socket event triggering so that the application can be notified immediately when anything changes.


  • New block: Sent when the Bitmark blockchain has a new block.
    • blockNumber : new block number
  • Bitmark changed: Sent when users issue new bitmarks, receive new bitmarks, or send them to a new owner.
    • bitmarkId: the id of the bitmark that changed
    • txId: the corresponding transaction id
    • presence: whether the bitmark is owned or not by the corresponding Account
  • New transfer offer: Sent when users receive new transfer offers, for two-signatures transfer.
    • bitmarkId: the id of the bitmark that’s offered.
  • New pending issuance: Sent when users issue new bitmarks.
    • bitmarkId : the id of the bitmark that’s issuing.
  • New pending transfer: Sent when a transfer occurs, to both sender and receiver.
    • txId: the transaction id
    • owner: the recipient of this transfer
    • prevTxId: the previous transaction id
    • prevOwner: the sender who made the transfer

Note: The attribute names could be different depending on the SDK used. This document refers specifically to the Java SDK.


  • WebSocket.ConnectionEvent connEvent = new WebSocket.ConnectionEvent() {
                public void onConnected() {
                public void onDisconnected() {
                public void onConnectionError(Throwable e) {
    BitmarkWebSocket ws = new BitmarkWebSocketService();
    // connect
    // disconnect
  • // TODO


  • // subscribe
                    new BitmarkWebSocket.BitmarkChangedEvent() {
                        public void onChanged(
                                String bitmarkId,
                                String txId,
                                boolean presence
                        ) {
                        public void onSubscribeSuccess(SubscribeSuccessEvent event) {
                        public void onSubscribeError(SubscribeErrorEvent event) {
    // unsubscribe
  • // TODO