blob: ca539ad64c0b05c80a995dfa069d0c1c18c3980c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
server = require('http').createServer(function() {});
webSocketServer = require('websocket').server;
server.listen(8080, function() {});
var wsServer = new webSocketServer({
httpServer: server
});
wsServer.on('request', function(request) {
//console.log('request');
var connection = request.accept(null);
connection.on('message', function(message) {
//console.log('message');
connection.send(message.utf8Data);
});
connection.on('close', function(r) {
//console.log('close');
});
});
|