Skip to content
Browse files

update example

  • Loading branch information...
1 parent 416bba9 commit 8eeb32db133c68f18039431ecb9bafdebddb8343 @dominictarr committed May 20, 2012
Showing with 7 additions and 18 deletions.
  1. +3 −2 example/client.js
  2. +4 −16 example/server.js
View
5 example/client.js
@@ -3,11 +3,12 @@ var bs = require('browser-stream')(io.connect('http://localhost:3000'))
var dominode = require('dominode.js')('#body', '<div id="item"></div>')
-rs = bs.createStream('whatever')
+rs = bs.createStream('whatever',
+ {options: true, random: Math.random()})
rs.pipe(dominode)
rs.on('data', function(d) {
- console.log(d)
+ console.log('>>>', d)
})
rs.write('hello')
View
20 example/server.js
@@ -10,31 +10,19 @@ var es = require('event-stream')
var fs = require('fs')
//TODO: allow both _bs(io) and _bs(connection)
-/*var app = http.createServer(function (req, res) {
-
- fs.createReadStream(__dirname + req.url).pipe(res)
-
-})*/
-
app = app
-// .use(function (req, res) {
-// res.end('HELLO')
-// })
.use(connect.static(__dirname))
.use(browserify(__dirname+'/client.js'))
-io = io.listen(app.listen(3000))
-
-//io = io.listen(app)
-
-console.log(io)
+io = io.listen(app.listen(3000, function () {
+ console.log('BrowserStream example running on port 3000')
+}))
io.on('connection', function (sock) {
var bs = _bs(sock)
-
bs.on('connection', function (stream) {
+ console.log('STREAM OPTIONS', stream)
stream.pipe(es.stringify()).pipe(es.log())
- console.log('OPEN', stream, stream.__proto__)
var i = 0
var t
t = setInterval(function () {

0 comments on commit 8eeb32d

Please sign in to comment.
Something went wrong with that request. Please try again.