mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
added socket files
This commit is contained in:
parent
61c7fb0e7b
commit
b34c1cd456
2 changed files with 30 additions and 0 deletions
17
lib/client/socket.js
Normal file
17
lib/client/socket.js
Normal 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
13
lib/server/socket.js
Normal 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 () { });
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue