FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-spider/baiwan/app.js at master · HooRang/python-spider · GitHub
HooRang
python-spider
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python-spider
/
baiwan
/
app.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
52 lines (51 loc) · 1.37 KB
Breadcrumbs
python-spider
/
baiwan
/
app.js
Copy path
File metadata and controls
52 lines (51 loc) · 1.37 KB
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
47
48
49
50
51
52
var
http
=
require
(
'http'
)
;
var
fs
=
require
(
'fs'
)
;
var
schedule
=
require
(
"node-schedule"
)
;
var
message
=
{
}
;
var
count
=
0
;
var
server
=
http
.
createServer
(
function
(
req
,
res
)
{
fs
.
readFile
(
'./index.html'
,
function
(
error
,
data
)
{
res
.
writeHead
(
200
,
{
'Content-Type'
:
'text/html'
}
)
;
res
.
end
(
data
,
'utf-8'
)
;
}
)
;
}
)
.
listen
(
80
)
;
console
.
log
(
'Server running!'
)
;
var
lineReader
=
require
(
'line-reader'
)
;
function
messageGet
(
)
{
lineReader
.
eachLine
(
'file.txt'
,
function
(
line
,
last
)
{
count
++
;
var
name
=
'line'
+
count
;
console
.
log
(
name
)
;
console
.
log
(
line
)
;
message
[
name
]
=
line
;
}
)
;
if
(
count
==
25
)
{
count
=
0
;
}
else
{
for
(
var
i
=
count
+
1
;
i
<=
25
;
i
++
)
{
var
name
=
'line'
+
i
;
message
[
name
]
=
'f'
;
}
count
=
0
;
}
}
var
io
=
require
(
'socket.io'
)
.
listen
(
server
)
;
var
rule
=
new
schedule
.
RecurrenceRule
(
)
;
var
times
=
[
]
;
for
(
var
i
=
1
;
i
<
1800
;
i
++
)
{
times
.
push
(
i
)
;
}
rule
.
second
=
times
;
schedule
.
scheduleJob
(
rule
,
function
(
)
{
messageGet
(
)
;
}
)
;
io
.
sockets
.
on
(
'connection'
,
function
(
socket
)
{
// console.log('User connected' + count + 'user(s) present');
socket
.
emit
(
'users'
,
message
)
;
socket
.
broadcast
.
emit
(
'users'
,
message
)
;
socket
.
on
(
'disconnect'
,
function
(
)
{
console
.
log
(
'User disconnected'
)
;
//socket.broadcast.emit('users',message);
}
)
;
}
)
;
Back
|
FazBrowse Home
|
New Git URL