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
ba74d1db
authored
2020-04-16 11:59:18 +0000
by
Glitch (hello-express)
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Checkpoint
./server.js:13690106/702
1 parent
18829464
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
radata/!
server.js
radata/!
View file @
ba74d1d
{"j":{"ack\u001bname":{"":{":":"Jack",">":1587032994032}},"ill\u001bname":{"":{":":"Jill",">":1587032608228.001}}}}
\ No newline at end of file
{"j":{"ack\u001bname":{"":{":":"Jack",">":1587037784462}},"ill\u001bname":{"":{":":"Jill",">":1587037784464.001}}},"zero":{"1\u001bname":{"":{":":"Jack",">":1587038341751}},"2\u001bname":{"":{":":"Jill",">":1587038341752.001}}}}
\ No newline at end of file
...
...
server.js
View file @
ba74d1d
...
...
@@ -25,7 +25,15 @@ server.on('upgrade', async function (request, socket, head) {
console
.
log
(
'Create id'
,
pathname
);
// NOTE: Only works with lib/ws.js shim allowing a predefined WS as ws.web parameter in Gun constructor
gun
.
server
=
new
WebSocket
.
Server
({
noServer
:
true
,
path
:
pathname
});
gun
.
gun
=
new
Gun
({
peers
:[],
localStorage
:
false
,
file
:
false
,
ws
:
{
noServer
:
true
,
path
:
pathname
,
web
:
gun
.
server
},
web
:
gun
.
server
});
console
.
log
(
'set peer'
,
request
.
headers
.
host
+
pathname
);
gun
.
gun
=
new
Gun
({
peers
:[],
// should we use self as peer?
localStorage
:
false
,
file
:
false
,
ws
:
{
noServer
:
true
,
path
:
pathname
,
web
:
gun
.
server
},
web
:
gun
.
server
});
gun
.
gun
.
on
(
"in"
,
function
(
msg
)
{
console
.
log
(
'got'
,
msg
)
});
lru
.
set
(
pathname
,
gun
);
}
}
...
...
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