optimise ws-stream.js