maxogden/websocket-stream — pull request #13 by substack (2013-06-22 09:49:48+00:00)
Title: buffer writes before onopen

Right now when you call `stream.write()` before the `'open'` event has fired, the DOM throws an:

```
Uncaught Error: InvalidStateError: DOM Exception 11 index.js:53
```

This patch buffers writes and flushes the buffer when the `'open'` event fires so people don't need to listen for open events before writing. Pretty much all other streams in node core work this way so I think people's expectations are violated the least when you can immediately start calling `stream.write()` on a writable stream.