Chat fiddling

added chat feature
Can you write a comment explaining what's happening in this file. Why is rootScope necessary? Why do you have to call apply?