Skip to content

Commit

Permalink
Merge pull request #311 from novoda/BOT-294/server_tests
Browse files Browse the repository at this point in the history
BOT-294/Server tests
  • Loading branch information
danybony authored Jul 17, 2017
2 parents 020b711 + d4f6976 commit 00fd506
Show file tree
Hide file tree
Showing 6 changed files with 1,453 additions and 13 deletions.
3 changes: 3 additions & 0 deletions TelepresenceBot/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 7 additions & 8 deletions TelepresenceBot/server-unit/core/testServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ var express = require('express');
var app = express();
var server = require('http').createServer(app);
var io = require('socket.io')(server);
var path = require('path')
var path = require('path');
var debug = require('debug')('server');

var server = server.listen(4200, function() {
console.log("Express server listening on port " + 4200);
debug("Express server listening on port %s", 4200);
});

app.use(express.static(path.join(__dirname, 'public')));
Expand All @@ -18,25 +19,23 @@ app.get('/rooms', function(req, res) {
res.sendFile(__dirname + '/json/rooms.json');
});

io.set("log level", 0);

io.sockets.on("connection", function (socket) {
console.log('a user connected');
debug('a user connected');

socket.on('disconnect', function(){
console.log('user disconnected');
debug('user disconnected');
});

socket.on('chat message', function(message){
console.log('message: ', message);
debug('message: %s', message);
});

socket.on("echo", function (msg, callback) {
callback = callback || function () {};

socket.emit("echo", msg);

console.log("on Connection");
debug("on Connection");

callback(null, "Done.");
});
Expand Down
Loading

0 comments on commit 00fd506

Please sign in to comment.