implement send/receive chat message function