From 284a028e1c691a6a52c71d0b384fc9b165b37810 Mon Sep 17 00:00:00 2001 From: Julien Bouquillon Date: Mon, 4 May 2020 01:22:18 +0200 Subject: [PATCH] fix: fix #918 only replace http if at the start of the url --- gun.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gun.js b/gun.js index c84c7f34..1fe9ece2 100644 --- a/gun.js +++ b/gun.js @@ -2404,7 +2404,7 @@ mesh.wire = opt.wire = open; function open(peer){ try{ if(!peer || !peer.url){ return wire && wire(peer) } - var url = peer.url.replace('http', 'ws'); + var url = peer.url.replace(/^http/, 'ws'); var wire = peer.wire = new opt.WebSocket(url); wire.onclose = function(){ opt.mesh.bye(peer);