implement functionality for chat view controller