FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Socket/JavaScript/3-server.js at master · yarchek/Socket · GitHub
yarchek
/
Socket
Public
forked from
HowProgrammingWorks/Socket
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
Socket
/
JavaScript
/
3-server.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
46 lines (35 loc) · 889 Bytes
Breadcrumbs
Socket
/
JavaScript
/
3-server.js
Copy path
File metadata and controls
46 lines (35 loc) · 889 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
'use strict'
;
const
net
=
require
(
'net'
)
;
const
server
=
net
.
createServer
(
(
socket
)
=>
{
console
.
dir
(
{
localAddress
:
socket
.
localAddress
,
localPort
:
socket
.
localPort
,
remoteAddress
:
socket
.
remoteAddress
,
remoteFamily
:
socket
.
remoteFamily
,
remotePort
:
socket
.
remotePort
,
bufferSize
:
socket
.
bufferSize
,
}
)
;
socket
.
write
(
'❤'
)
;
socket
.
on
(
'data'
,
(
data
)
=>
{
console
.
log
(
'Event: 📨'
)
;
console
.
log
(
'Data: '
+
data
)
;
}
)
;
socket
.
on
(
'drain'
,
(
)
=>
{
console
.
log
(
'Event: 🤷'
)
;
}
)
;
socket
.
on
(
'end'
,
(
)
=>
{
console
.
log
(
'Event: 🏁'
)
;
console
.
dir
(
{
bytesRead
:
socket
.
bytesRead
,
bytesWritten
:
socket
.
bytesWritten
,
}
)
;
}
)
;
socket
.
on
(
'error'
,
(
err
)
=>
{
console
.
log
(
'Event: 💩'
)
;
console
.
log
(
err
)
;
}
)
;
socket
.
on
(
'timeout'
,
(
)
=>
{
console
.
log
(
'Event: ⌛'
)
;
}
)
;
}
)
;
server
.
listen
(
2000
)
;
Back
|
FazBrowse Home
|
New Git URL