Guest User

Untitled

a guest
Oct 21st, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. /**
  2. * When a new topic is added under the path /chat/chatsessions/,
  3. * the addUser callback is called to add a representation of the
  4. * chat session to the agent interface.
  5. */
  6.  
  7. var registerTopicListener = function (session){
  8. var listener = {
  9. onDescendantNotification: function() {},
  10. onTopicNotification: function(topicPath, topicSpecification, type) {
  11. addUser(topicPath);
  12. },
  13. onClose: function() {},
  14. onError: function(error) {}
  15. };
  16.  
  17. session.notifications.addListener(listener).then(function(reg) {
  18. reg.select("*chat/chatsessions/");
  19. });
  20. return session;
  21. }
Add Comment
Please, Sign In to add comment