updated js for binding chat events