public class HttpProvider extends java.lang.Object implements IProvider
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
import org.polkadot.rpc.provider.http.HttpProvider;
HttpProvider provider = new HttpProvider('http://127.0.0.1:9933');
WsProvider
IProvider.CallbackHandler<T,U>, IProvider.ProviderInterfaceEmitCb, IProvider.ProviderInterfaceEmitted, IProvider.SubscriptionHandler
Constructor and Description |
---|
HttpProvider(java.lang.String endpoint) |
Modifier and Type | Method and Description |
---|---|
IProvider |
clone()
Returns a clone of the object
|
void |
disconnect()
Manually disconnect from the connection
|
boolean |
isConnected() |
boolean |
isHasSubscriptions()
true when this provider supports subscriptions |
void |
on(IProvider.ProviderInterfaceEmitted emitted,
EventEmitter.EventListener cb)
Events are not supported with the HttpProvider, see
WsProvider . |
<any> |
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.
|
<any> |
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 . |
<any> |
unsubscribe(java.lang.String type,
java.lang.String method,
int id)
Subscriptions are not supported with the HttpProvider, see
WsProvider . |
public boolean isHasSubscriptions()
true
when this provider supports subscriptions
isHasSubscriptions
in interface IProvider
public IProvider clone()
Returns a clone of the object
public void disconnect()
Manually disconnect from the connection
disconnect
in interface IProvider
public boolean isConnected()
isConnected
in interface IProvider
public void on(IProvider.ProviderInterfaceEmitted emitted, EventEmitter.EventListener cb)
Events are not supported with the HttpProvider, see WsProvider
. HTTP Provider does not have ‘on’ emitters. WebSockets should be used instead.
public <any> 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.
public <any> 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
.
public <any> unsubscribe(java.lang.String type, java.lang.String method, int id)
Subscriptions are not supported with the HttpProvider, see WsProvider
.
unsubscribe
in interface IProvider