Added Code for Chat functionality