socket close handler, message unification