fix: connection url can upgrade to a websocket if no port is supplied

This commit is contained in:
Michael Vines
2020-04-13 17:42:33 -07:00
parent 3aee5149a0
commit 3a1c582df5
2 changed files with 4 additions and 5 deletions

View File

@ -806,9 +806,8 @@ export class Connection {
url.protocol = url.protocol === 'https:' ? 'wss:' : 'ws:'; url.protocol = url.protocol === 'https:' ? 'wss:' : 'ws:';
url.host = ''; url.host = '';
url.port = String(Number(url.port) + 1); if (url.port !== null) {
if (url.port === '1') { url.port = String(Number(url.port) + 1);
url.port = url.protocol === 'wss:' ? '8901' : '8900';
} }
this._rpcWebSocket = new RpcWebSocketClient(urlFormat(url), { this._rpcWebSocket = new RpcWebSocketClient(urlFormat(url), {
autoconnect: false, autoconnect: false,

View File

@ -6,5 +6,5 @@
export const url = 'http://localhost:8899/'; export const url = 'http://localhost:8899/';
//export const url = 'https://devnet.solana.com:8443/'; //export const url = 'https://devnet.solana.com/';
//export const url = 'http://devnet.solana.com:8899/'; //export const url = 'http://devnet.solana.com/';