Skip to content

Commit

Permalink
notes for production use
Browse files Browse the repository at this point in the history
  • Loading branch information
dominictarr committed Apr 3, 2013
1 parent a138e93 commit d3f65b8
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions readme.markdown
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -55,6 +55,24 @@ net.createServer(function (stream) {
}).listen(port) }).listen(port)
``` ```
### Errors, and use in PRODUCTION
`mux-demux` parses a `JSON` protocol, and so you must handle any errors
that may result from someone connecting, and sending invalid data.
``` js
net.createServer(function (stream) {
var mx = MuxDemux()
stream.pipe(mx).pipe(stream)
mx.on('error', function () {
stream.destroy()
})
stream.on('error', function () {
mx.destroy()
})
}).listen(9999)
```
#API #API
the API [browser-stream](http://github.com/dominictarr/browser-stream#api) the API [browser-stream](http://github.com/dominictarr/browser-stream#api)
Expand Down

0 comments on commit d3f65b8

Please sign in to comment.