summaryrefslogtreecommitdiffhomepage
path: root/test/node/websockets/mirror_fragmentation/app.js
blob: 7024252a259dd05b325a05125e910288bb898d72 (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
24
25
26
#!/usr/bin/env node

server = require('unit-http').createServer(function() {});
webSocketServer = require('unit-http/websocket').server;
//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');
  });
});