fix: use secure websocket when https JSON RPC endpoint is requested
This commit is contained in:
parent
452fd1b785
commit
cbcb774c82
|
@ -222,11 +222,11 @@ export class Connection {
|
||||||
transactionSignatures: [],
|
transactionSignatures: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
url.protocol = 'ws';
|
url.protocol = url.protocol === 'https:' ? 'wss:' : 'ws:';
|
||||||
url.host = '';
|
url.host = '';
|
||||||
url.port = String(Number(url.port) + 1);
|
url.port = String(Number(url.port) + 1);
|
||||||
if (url.port === '1') {
|
if (url.port === '1') {
|
||||||
url.port = '8900';
|
url.port = url.protocol === 'wss:' ? '8901' : '8900';
|
||||||
}
|
}
|
||||||
this._rpcWebSocket = new RpcWebSocketClient(
|
this._rpcWebSocket = new RpcWebSocketClient(
|
||||||
urlFormat(url),
|
urlFormat(url),
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
/**
|
/**
|
||||||
* The connection url to use when running unit tests against a live network
|
* The connection url to use when running unit tests against a live network
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export const url = 'http://localhost:8899/';
|
export const url = 'http://localhost:8899/';
|
||||||
|
|
||||||
|
//export const url = 'https://api.testnet.solana.com/';
|
||||||
|
//export const url = 'https://api.testnet.solana.com/';
|
||||||
//export const url = 'http://testnet.solana.com:8899/';
|
//export const url = 'http://testnet.solana.com:8899/';
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue