added socket files

This commit is contained in:
coderaiser 2012-08-23 09:52:27 -04:00
parent 61c7fb0e7b
commit b34c1cd456
2 changed files with 30 additions and 0 deletions

17
lib/client/socket.js Normal file
View file

@ -0,0 +1,17 @@
/* module make possible connectoin thrue socket.io on a client */
var CloudCommander, io;
(function(){
"use strict";
var Util = CloudCommander.Util;
Util.jsload("http://localhost:31337/socket.io/lib/socket.io.js", function(){
var socket = io.connect('http://localhost:31337/');
socket.on('connect', function () {
socket.send('hi');
socket.on('message', function (msg) {
console.log(msg);
});
});
});
})();

13
lib/server/socket.js Normal file
View file

@ -0,0 +1,13 @@
/* module make possible connectoin thrue socket.io on a server */
var CloudServer;
var io = require('socket.io').listen(CloudServer.Server);
io.sockets.on('connection', function (socket) {
socket.on('message', function (data) {
console.log(data);
});
socket.on('disconnect', function () { });
});