[enhancement] Let `Socket.prototype.write` the function can write a js object.

I added 7 lines to the `Socket.prototype.write` function's body, that  let this one can receive an object as the chunk.