Package org.polkadot.rpc.provider.http
Class HttpProvider
- java.lang.Object
-
- org.polkadot.rpc.provider.http.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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.polkadot.rpc.provider.IProvider
IProvider.CallbackHandler<T,U>, IProvider.ProviderInterfaceEmitCb, IProvider.ProviderInterfaceEmitted, IProvider.SubscriptionHandler
-
-
Constructor Summary
Constructors Constructor Description HttpProvider(java.lang.String endpoint)
-
Method Summary
Modifier and Type Method Description IProviderclone()Returns a clone of the objectvoiddisconnect()Manually disconnect from the connectionbooleanisConnected()booleanisHasSubscriptions()`true` when this provider supports subscriptionsvoidon(IProvider.ProviderInterfaceEmitted emitted, EventEmitter.EventListener cb)Events are not supported with the HttpProvider, seeWsProvider.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.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, seeWsProvider.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, seeWsProvider.
-
-
-
Method Detail
-
isHasSubscriptions
public boolean isHasSubscriptions()
`true` when this provider supports subscriptions- Specified by:
isHasSubscriptionsin interfaceIProvider
-
clone
public IProvider clone()
Returns a clone of the object
-
disconnect
public void disconnect()
Manually disconnect from the connection- Specified by:
disconnectin interfaceIProvider
-
isConnected
public boolean isConnected()
- Specified by:
isConnectedin interfaceIProvider- Returns:
- {boolean} true if connected Whether the node is connected or not.
-
on
public void on(IProvider.ProviderInterfaceEmitted emitted, EventEmitter.EventListener cb)
Events are not supported with the HttpProvider, seeWsProvider. HTTP Provider does not have 'on' emitters. WebSockets should be used instead.
-
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.
-
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, seeWsProvider.
-
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, seeWsProvider.- Specified by:
unsubscribein interfaceIProvider
-
-