Class ListenerOkHttp

  • All Implemented Interfaces:
    io.nem.sdk.api.Listener, java.io.Closeable, java.lang.AutoCloseable

    public class ListenerOkHttp
    extends io.nem.sdk.infrastructure.ListenerBase
    implements io.nem.sdk.api.Listener
    OkHttp implementations of the Listener.
    Since:
    1.0
    • Constructor Summary

      Constructors 
      Constructor Description
      ListenerOkHttp​(okhttp3.OkHttpClient httpClient, java.lang.String url, io.nem.sdk.openapi.okhttp_gson.invoker.JSON json)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Close webSocket connection
      java.util.concurrent.CompletableFuture<java.lang.Void> open()  
      protected void subscribeTo​(java.lang.String channel)  
      protected io.nem.sdk.model.blockchain.BlockInfo toBlockInfo​(java.lang.Object blockInfoDTO)  
      protected io.nem.sdk.model.transaction.Transaction toTransaction​(java.lang.Object transactionInfo)  
      • Methods inherited from class io.nem.sdk.infrastructure.ListenerBase

        aggregateBondedAdded, aggregateBondedAdded, aggregateBondedRemoved, confirmed, confirmed, cosignatureAdded, getJsonHelper, getMessageSubject, getUid, handle, newBlock, setUid, status, transactionFromAddress, unconfirmedAdded, unconfirmedRemoved
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface io.nem.sdk.api.Listener

        aggregateBondedAdded, aggregateBondedAdded, aggregateBondedRemoved, confirmed, confirmed, cosignatureAdded, getUid, newBlock, status, unconfirmedAdded, unconfirmedRemoved
    • Constructor Detail

      • ListenerOkHttp

        public ListenerOkHttp​(okhttp3.OkHttpClient httpClient,
                              java.lang.String url,
                              io.nem.sdk.openapi.okhttp_gson.invoker.JSON json)
        Parameters:
        httpClient - the ok http client
        url - nis host
        json - gson's json.
    • Method Detail

      • open

        public java.util.concurrent.CompletableFuture<java.lang.Void> open()
        Specified by:
        open in interface io.nem.sdk.api.Listener
        Returns:
        a CompletableFuture that resolves when the websocket connection is opened
      • toBlockInfo

        protected io.nem.sdk.model.blockchain.BlockInfo toBlockInfo​(java.lang.Object blockInfoDTO)
        Specified by:
        toBlockInfo in class io.nem.sdk.infrastructure.ListenerBase
      • toTransaction

        protected io.nem.sdk.model.transaction.Transaction toTransaction​(java.lang.Object transactionInfo)
        Specified by:
        toTransaction in class io.nem.sdk.infrastructure.ListenerBase
      • close

        public void close()
        Close webSocket connection
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface io.nem.sdk.api.Listener
      • subscribeTo

        protected void subscribeTo​(java.lang.String channel)
        Specified by:
        subscribeTo in class io.nem.sdk.infrastructure.ListenerBase