-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
- Loading branch information
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
var WebSocket = require('ws'); | ||
var ws = new WebSocket('ws://127.0.0.1:8080'); | ||
|
||
ws.on('open', function open(){ | ||
ws.send('client something'); | ||
}); | ||
|
||
ws.on('message', function(data, flags){ | ||
console.log(data); | ||
console.log(flags); | ||
ws.close(); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
var mockData = { | ||
"latitude": "30.58", | ||
"longitude": "114.27", | ||
"countrycode": "CN", | ||
"country": "CN", | ||
"city": "武汉", | ||
"org": "中国湖北省网络", | ||
"latitude2": "38.62", | ||
"longitude2": "-90.35", | ||
"countrycode2": "US", | ||
"country2": "US", | ||
"city2": "洛杉矶", | ||
"type": "ipviking.honey", | ||
"md5": "221.235.189.244", | ||
"dport": "22", | ||
"zerg": "rush" | ||
}; | ||
|
||
var WebSocketServer = require('ws').Server, | ||
wss = new WebSocketServer({ | ||
port: 8080 | ||
}); | ||
|
||
wss.on('connection', function connection(ws) { | ||
ws.on('message', function incoming(message) { | ||
console.log('received: %s', message); | ||
}); | ||
|
||
mockData.dport = "21"; | ||
ws.send(JSON.stringify(mockData)); | ||
ws.close(); | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.