updated message sending and receiving on client, works with multi-tabs