From b796c59c163a5fca2d3b18eca93d6faa8b3d854a Mon Sep 17 00:00:00 2001 From: coderaiser Date: Thu, 23 Aug 2012 09:52:27 -0400 Subject: [PATCH] added socket files --- lib/client/socket.js | 17 +++++++++++++++++ lib/server/socket.js | 13 +++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 lib/client/socket.js create mode 100644 lib/server/socket.js diff --git a/lib/client/socket.js b/lib/client/socket.js new file mode 100644 index 00000000..fb686008 --- /dev/null +++ b/lib/client/socket.js @@ -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); + }); + }); + }); +})(); \ No newline at end of file diff --git a/lib/server/socket.js b/lib/server/socket.js new file mode 100644 index 00000000..4f51342c --- /dev/null +++ b/lib/server/socket.js @@ -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 () { }); +}); \ No newline at end of file