Browse files

changed examples require to nssocket to nss

  • Loading branch information...
1 parent 3ba77bf commit d3f6feb0516a2b94617380d314474f3373c9077f @kilianc committed Jul 8, 2012
Showing with 17 additions and 17 deletions.
  1. +2 −2 examples/bla.js
  2. +2 −2 examples/foo.js
  3. +2 −2 examples/reconnect.js
  4. +6 −6 examples/simple-protocol.js
  5. +5 −5 examples/verbose-protocol.js
View
4 examples/bla.js
@@ -1,7 +1,7 @@
-var nssocket = require('../')
+var nss = require('../')
var sockets = []
-nssocket.createServer(function (socket) {
+nss.createServer(function (socket) {
sockets.push(socket)
socket.ondata('connecting', function (data) {
console.log('There are now', sockets.length)
View
4 examples/foo.js
@@ -1,5 +1,5 @@
-var nssocket = require('../')
-var outbound = nssocket()
+var nss = require('../')
+var outbound = nss()
outbound.on('data::broadcasting', function (data) {
console.log(data)
View
4 examples/reconnect.js
@@ -1,12 +1,12 @@
var net = require('net'),
- nssocket = require('../')
+ nss = require('../')
net.createServer(function (socket) {
setTimeout(function () {
socket.destroy()
}, 1000)
}).listen(8345)
-nssocket({ reconnect: true }).on('start', function () {
+nss.createClient({ reconnect: true }).on('start', function () {
console.log('start')
}).connect(8345)
View
12 examples/simple-protocol.js
@@ -1,4 +1,4 @@
-var nssocket = require('../')
+var nss = require('../')
//
// define a simple message protocol as [<type>, <id>] and create some messages that use it.
@@ -7,12 +7,12 @@ var message1 = ['message', 'one']
var message2 = ['message', 'two']
//
-// Create an `nssocket` TCP server and tell the server to listen on port `6785`.
+// Create an `nss` TCP server and tell the server to listen on port `6785`.
//
-var server = nssocket.createServer(function (socket) {
+var server = nss.createServer(function (socket) {
//
- // Here `socket` will be an instance of `nssocket.NsSocket`.
+ // Here `socket` will be an instance of `NsSocket`.
// When there is a connection, send `message1` to the socket.
//
socket.send(message1)
@@ -33,11 +33,11 @@ var server = nssocket.createServer(function (socket) {
}).listen(6785)
//
-// Create a new `nssocket` instance and then connect to the server in 1000 miliseconds.
+// Create a new `NsSocket` instance and then connect to the server in 1000 miliseconds.
//
setTimeout(function() {
- var outbound = nssocket()
+ var outbound = nss()
//
//
View
10 examples/verbose-protocol.js
@@ -1,11 +1,11 @@
- var nssocket = require('../')
+ var nss = require('../')
//
- // Create an `nssocket` TCP server
+ // Create an `nss` TCP server
//
- var server = nssocket.createServer(function (socket) {
+ var server = nss.createServer(function (socket) {
//
- // Here `socket` will be an instance of `nssocket.NsSocket`.
+ // Here `socket` will be an instance of `NsSocket`.
//
socket.send(['drink', 'rum'])
@@ -28,7 +28,7 @@
//
server.listen(6785)
- nssocket().ondata(['drink', '*'], function () {
+ nss().ondata(['drink', '*'], function () {
console.log('I can mix a', this.event[2], 'drink')
//outbound.send(['iam', 'here'], { iam: true, indeedHere: true })
}).connect(6785)

0 comments on commit d3f6feb

Please sign in to comment.