From b0de4027e35da3dab4aea33efb75718f0c7b063f Mon Sep 17 00:00:00 2001 From: genderev <60559370+genderev@users.noreply.github.com> Date: Fri, 10 Apr 2020 01:44:09 +0000 Subject: [PATCH 1/2] Update README.md --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 433ca715..1a7b06f5 100644 --- a/README.md +++ b/README.md @@ -231,12 +231,14 @@ now --npm amark/gun Then visit the URL in the output of the 'now --npm' step, in your browser. -### [Unebo](https://unubo.app/) +### [Unubo](https://unubo.app/) -Fork this GUN repo (Unebo only deploys from your own GitHub repo's). -Add a Node.js app, select your GUN fork, set `npm start` start as the command and deploy. +Fork this GUN repo (Unubo only deploys from your own GitHub repo's). +Add a Node.js app, select your GUN fork, set `npm start` start as the command and deploy. -Then visit the deployed app by following the 'view app' button, in your browser. +From the experience of [genderev](https://github.com/genderev), this only works if you set your country to the United States. + +Visit the deployed app by following the 'view app' button, in your browser. ### [Docker](https://www.docker.com/) From 4124a2db50834c940e4a0afda050c8c516417808 Mon Sep 17 00:00:00 2001 From: Lorenzo Mangani Date: Thu, 16 Apr 2020 21:54:02 +0200 Subject: [PATCH 2/2] Allow externally provided websockets in constructor For consideration (this can also be overloaded in stock gun) The current ws.js code does not allow providing an external websocket while initializing Gun. This one line patch makes it possible: ``` var myWS= new WebSocket.Server({ noServer: true, path: pathname}); var myGun = new Gun({ ws: { noServer: true, path: '/mygun', web: myWS }, web: myWS }); ``` --- lib/ws.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ws.js b/lib/ws.js index a37da6b7..66b3a8fa 100644 --- a/lib/ws.js +++ b/lib/ws.js @@ -19,7 +19,7 @@ Gun.on('opt', function mount(ctx){ ws.server = ws.server || opt.web; ws.path = ws.path || '/gun'; - ws.web = new WebSocket.Server(ws); + if (!ws.web) ws.web = new WebSocket.Server(ws); ws.web.on('connection', function(wire){ wire.upgradeReq = wire.upgradeReq || {};