Browse files

[examples] adds some docs to matching examples

  • Loading branch information...
1 parent 8642beb commit 9a6aa0a61664767ed7d4535200583b2a8093fb3e @dscape dscape committed Dec 27, 2012
Showing with 15 additions and 5 deletions.
  1. +5 −1 examples/bla.js
  2. +10 −4 examples/foo.js
View
6 examples/bla.js
@@ -1,8 +1,12 @@
var nss = require('../');
var sockets = [];
+
+//
+// Server code for foo.js to connect to
+//
nss.createServer(function (socket) {
- sockets.push(socket);
+ sockets.push(socket);
socket.ondata('connecting', function (data) {
console.log('There are now', sockets.length);
sockets.forEach(function (s) {
View
14 examples/foo.js
@@ -1,8 +1,14 @@
var nss = require('../');
var outbound = nss();
-outbound.on('data::broadcasting', function (data) {
- console.log(data);
-}).connect(4949, function () {
- outbound.send('connecting', { 'random' : Math.random() });
+//
+// Example to connect to bla.js
+//
+outbound
+ .on('data::broadcasting', function (data) {
+ console.log(data);
+ })
+ .connect(4949, function () {
+ outbound.send('connecting', { 'random' : Math.random()
+ });
});

0 comments on commit 9a6aa0a

Please sign in to comment.