Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Jabis Sev贸n
/
gun-multiserver
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
61c10c5c
authored
2020-04-16 08:14:17 +0000
by
Glitch (hello-express)
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Checkpoint
./server.js:13690106/110
1 parent
b57cfbea
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
server.js
server.js
View file @
61c10c5
...
...
@@ -24,8 +24,9 @@ server.on('upgrade', async function (request, socket, head) {
console
.
log
(
'Create id'
,
pathname
);
// HOW HOW HOW ? IS it even possible to attach the WS to the Gun Object alone?
// Works only when passing "server" to the web parameter, no WS/WSS)
gun
.
server
=
new
WebSocket
.
Server
({
noServer
:
true
});
gun
.
gun
=
new
Gun
({
peers
:[],
ws
:
{
path
:
pathname
,
noServer
:
true
,
server
:
gun
.
server
},
web
:
server
});
// gun.server = new WebSocket.Server({ noServer: true});
gun
.
gun
=
new
Gun
({
peers
:[],
ws
:
{
path
:
pathname
,
noServer
:
true
}});
gun
.
server
=
gun
.
gun
.
opt
().
ws
;
lru
.
set
(
pathname
,
gun
);
}
}
...
...
@@ -35,7 +36,7 @@ server.on('upgrade', async function (request, socket, head) {
//ws.emit('connection', socket);
gun
.
server
.
handleUpgrade
(
request
,
socket
,
head
,
function
(
ws
)
{
console
.
log
(
'connecting to gun.. '
)
gun
.
server
.
emit
(
'connection'
,
ws
);
gun
.
server
.
emit
(
'connection'
,
ws
,
request
);
});
}
else
{
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment