Connection constructor
Connection(
- Cluster httpCluster, {
- Cluster? websocketCluster,
- Commitment? commitment = Commitment.confirmed,
Creates a connection to invoke JSON RPC methods.
Implementation
Connection(
this.httpCluster, {
final Cluster? websocketCluster,
this.commitment = Commitment.confirmed,
}) : websocketCluster = websocketCluster ?? httpCluster.toWebsocket() {
httpClient = JsonRpcHttpClient(httpCluster.uri);
websocketClient = JsonRpcWebsocketClient.withStringDecoder(
this.websocketCluster.uri,
onConnect: onWebsocketConnect,
onDisconnect: onWebsocketDisconnect,
onData: onWebsocketData,
onError: onWebsocketError,
);
}