[RFC] Refactor WStream to enable writing the same buffer to multiple targets

This adds a WBuffer struct which contains a refcount, and is freed automatically by the wstream module when it reaches 0. This will be necessary for broadcasting events without redundant copies of the output buffer.