FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Socket/JavaScript/4-client.js at master · HowProgrammingWorks/Socket · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
HowProgrammingWorks
/
Socket
Public
Notifications
You must be signed in to change notification settings
Fork
4
Star
9
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Socket
/
JavaScript
/
4-client.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
46 lines (36 loc) · 763 Bytes
Breadcrumbs
Socket
/
JavaScript
/
4-client.js
Copy path
File metadata and controls
46 lines (36 loc) · 763 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
(
'node:net'
)
;
const
socket
=
new
net
.
Socket
(
)
;
const
send
=
(
message
)
=>
{
console
.
log
(
'Client >'
,
message
)
;
socket
.
write
(
message
)
;
}
;
socket
.
on
(
'data'
,
(
data
)
=>
{
console
.
log
(
'Server >'
,
data
.
toString
(
)
,
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: ⌛'
)
;
}
)
;
socket
.
on
(
'connect'
,
(
)
=>
{
send
(
'💋'
)
;
send
(
'💋'
)
;
send
(
'💋'
)
;
}
)
;
socket
.
connect
(
{
port
:
2000
,
host
:
'127.0.0.1'
,
}
)
;
Back
|
FazBrowse Home
|
New Git URL