
Checkpoint
./server.js:13690106/110
Showing
1 changed file
with
4 additions
and
3 deletions
... | @@ -24,8 +24,9 @@ server.on('upgrade', async function (request, socket, head) { | ... | @@ -24,8 +24,9 @@ server.on('upgrade', async function (request, socket, head) { |
24 | console.log('Create id',pathname); | 24 | console.log('Create id',pathname); |
25 | // HOW HOW HOW ? IS it even possible to attach the WS to the Gun Object alone? | 25 | // HOW HOW HOW ? IS it even possible to attach the WS to the Gun Object alone? |
26 | // Works only when passing "server" to the web parameter, no WS/WSS) | 26 | // Works only when passing "server" to the web parameter, no WS/WSS) |
27 | gun.server = new WebSocket.Server({ noServer: true}); | 27 | // gun.server = new WebSocket.Server({ noServer: true}); |
28 | gun.gun = new Gun({peers:[], ws: { path: pathname, noServer: true, server: gun.server }, web: server}); | 28 | gun.gun = new Gun({peers:[], ws: { path: pathname, noServer: true }}); |
29 | gun.server = gun.gun.opt().ws; | ||
29 | lru.set(pathname,gun); | 30 | lru.set(pathname,gun); |
30 | } | 31 | } |
31 | } | 32 | } |
... | @@ -35,7 +36,7 @@ server.on('upgrade', async function (request, socket, head) { | ... | @@ -35,7 +36,7 @@ server.on('upgrade', async function (request, socket, head) { |
35 | //ws.emit('connection', socket); | 36 | //ws.emit('connection', socket); |
36 | gun.server.handleUpgrade(request, socket, head, function (ws) { | 37 | gun.server.handleUpgrade(request, socket, head, function (ws) { |
37 | console.log('connecting to gun.. ') | 38 | console.log('connecting to gun.. ') |
38 | gun.server.emit('connection', ws); | 39 | gun.server.emit('connection', ws, request); |
39 | }); | 40 | }); |
40 | 41 | ||
41 | } else { | 42 | } else { | ... | ... |
-
Please register or sign in to post a comment