fix publish concurrency issues 

publishing a message used to generate at least two socket.write calls, in a scenario where a lot of messages are sent async to the same channel it would cause out of order frames with enough load.

This fix only affects the publish method and bundles all its data including the content in one call and one socket.write