blob: ea580ac263d978cb2e8c4f31c3027cb51ede8510 (
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(7080, 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');
});
});
|