fix: use secure websocket when https JSON RPC endpoint is requested

This commit is contained in:
Michael Vines 2018-11-02 16:09:34 -07:00
parent 452fd1b785
commit cbcb774c82
2 changed files with 6 additions and 2 deletions

View File

@ -222,11 +222,11 @@ export class Connection {
transactionSignatures: [],
};
url.protocol = 'ws';
url.protocol = url.protocol === 'https:' ? 'wss:' : 'ws:';
url.host = '';
url.port = String(Number(url.port) + 1);
if (url.port === '1') {
url.port = '8900';
url.port = url.protocol === 'wss:' ? '8901' : '8900';
}
this._rpcWebSocket = new RpcWebSocketClient(
urlFormat(url),

View File

@ -3,6 +3,10 @@
/**
* The connection url to use when running unit tests against a live network
*/
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/';