-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathresponse.js
More file actions
26 lines (19 loc) · 702 Bytes
/
Copy pathresponse.js
File metadata and controls
26 lines (19 loc) · 702 Bytes
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
var io = require('socket.io-client');
var message = "o bispo de constantinopla nao quer se desconstantinopolizar";
function user(host, port) {
var start = new Date();
var socket = io.connect('http://' + host + ':' + port, {'force new connection': true});
socket.on('connect', function() {
// send loop message
socket.send(message);
socket.on('message', function(message) {
console.log(new Date() - start)
start = new Date();
socket.send(message);
});
});
};
var argvIndex = 2;
var host = process.argv[argvIndex++] ? process.argv[argvIndex - 1] : 'localhost';
var port = process.argv[argvIndex++] ? process.argv[argvIndex - 1] : '3000';
user(host, port)