add write_msg for connection.

Signed-off-by: jack <jack.wgm@gmail.com>