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
cf8f2cb1
authored
2020-04-15 19:58:13 +0000
by
Glitch (hello-express)
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Checkpoint
./server.js:13690106/227
1 parent
d2d856d0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
server.js
server.js
View file @
cf8f2cb
...
...
@@ -12,13 +12,16 @@ var wss_event = new WebSocket.Server({ noServer: true});
server
.
on
(
'upgrade'
,
async
function
(
request
,
socket
,
head
)
{
var
pathname
=
url
.
parse
(
request
.
url
).
pathname
||
'/gun'
;
console
.
log
(
'Got WS request'
,
pathname
);
var
gun
=
false
;
if
(
pathname
){
if
(
lru
.
has
(
pathname
)){
// Existing Node
console
.
log
(
'Recycle id'
,
pathname
);
gun
=
await
lru
.
get
(
pathname
);
}
else
{
// Create Node
console
.
log
(
'Create id'
,
pathname
);
gun
=
await
Gun
({
peers
:[],
ws
:
{
noServer
:
true
}});
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