clear message buffer on connection
added writing message