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
8a023531
authored
2020-04-15 17:51:14 +0000
by
Glitch (hello-express)
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Checkpoint
./server.js:13690106/274
1 parent
4cd6a320
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
server.js
server.js
View file @
8a02353
var
Gun
=
require
(
'gun'
);
var
http
=
require
(
'http'
);
var
server
=
http
.
createServer
().
listen
(
300
);
var
wss_event
=
new
WebSocket
.
Server
({
noServer
:
true
});
const
url
=
require
(
'url'
);
const
Gun
=
require
(
'gun'
);
const
http
=
require
(
'http'
);
const
WebSocket
=
require
(
'ws'
);
var
server
=
http
.
createServer
().
listen
(
3000
);
var
wss_event
=
new
WebSocket
.
Server
({
noServer
:
true
});
server
.
on
(
'upgrade'
,
function
(
request
,
socket
,
head
)
{
var
pathname
=
url
.
parse
(
request
.
url
).
pathname
;
if
(
pathname
===
'/sim_world'
)
{
if
(
pathname
===
'/gun1'
)
{
wss_event
.
handleUpgrade
(
request
,
socket
,
head
,
function
(
ws
)
{
wss_event
.
emit
(
'connection'
,
ws
);
});
}
else
if
(
pathname
===
'/gun2'
)
{
wss_event
.
handleUpgrade
(
request
,
socket
,
head
,
function
(
ws
)
{
wss_event
.
emit
(
'connection'
,
ws
);
});
...
...
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