Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow externally provided websockets in constructor #930

Merged
merged 1 commit into from
Apr 19, 2020

Conversation

lmangani
Copy link
Contributor

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. Additional checks might be suitable to determine if the passed object is actually a websocket, etc.

        var myWS= new WebSocket.Server({ noServer: true, path: pathname});
        var myGun = new Gun({ 
            ws: { noServer: true, path: '/mygun', web: myWS }, 
            web: myWS 
        });

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 
        });
```
@amark amark merged commit 5bedffc into amark:master Apr 19, 2020
@amark
Copy link
Owner

amark commented Apr 19, 2020

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants