Class HttpProvider

  • All Implemented Interfaces:
    IProvider

    public class HttpProvider
    extends java.lang.Object
    implements IProvider
    # @polkadot/rpc-provider/https HttpProvider The HTTP Provider allows sending requests using HTTP to a HTTP RPC server TCP port. It does not support subscriptions so you won't be able to listen to events such as new blocks or balance changes. It is usually preferrable using the WsProvider. **Example** ```java import org.polkadot.rpc.provider.http.HttpProvider; HttpProvider provider = new HttpProvider('http://127.0.0.1:9933'); ```
    See Also:
    WsProvider
    • Constructor Detail

      • HttpProvider

        public HttpProvider​(java.lang.String endpoint)
    • Method Detail

      • isHasSubscriptions

        public boolean isHasSubscriptions()
        `true` when this provider supports subscriptions
        Specified by:
        isHasSubscriptions in interface IProvider
      • clone

        public IProvider clone()
        Returns a clone of the object
        Specified by:
        clone in interface IProvider
        Overrides:
        clone in class java.lang.Object
      • disconnect

        public void disconnect()
        Manually disconnect from the connection
        Specified by:
        disconnect in interface IProvider
      • isConnected

        public boolean isConnected()
        Specified by:
        isConnected in interface IProvider
        Returns:
        {boolean} true if connected Whether the node is connected or not.
      • send

        public com.onehilltech.promises.Promise<java.lang.String> send​(java.lang.String method,
                                                                       java.util.List<java.lang.Object> params,
                                                                       IProvider.SubscriptionHandler subscriptionHandler)
        Send HTTP POST Request with Body to configured HTTP Endpoint.
        Specified by:
        send in interface IProvider
      • subscribe

        public com.onehilltech.promises.Promise<java.lang.String> subscribe​(java.lang.String type,
                                                                            java.lang.String method,
                                                                            java.util.List<java.lang.Object> params,
                                                                            IProvider.CallbackHandler cb)
        Subscriptions are not supported with the HttpProvider, see WsProvider.
        Specified by:
        subscribe in interface IProvider
      • unsubscribe

        public com.onehilltech.promises.Promise<java.lang.String> unsubscribe​(java.lang.String type,
                                                                              java.lang.String method,
                                                                              int id)
        Subscriptions are not supported with the HttpProvider, see WsProvider.
        Specified by:
        unsubscribe in interface IProvider