Fix streaming socket & port to es5

I fixed a few implementation bugs in your streaming socket example.

I also ported it to ES5.

These are two seperate commits, at least take the first.

The motivation to port to ES5 is to match the rest of the document and to make it easier to read the implementation for those not familiar with ES6.

Of course I understand and appreciate the usage of `yield` and generators for your examples, that's a valid use of ES6.