Search code examples
angularxmppejabberdstrophe.js

strophe js receives a single message using with angular 4


I am using Strophe.js to connect with XMPP server in angular4. connection.addHandler() received a single message. I add this listener after successful connection.

connection.addHandler(this.receiveMessage, null, 'message');

Please tell what I missing or incorrect.


Solution

  • Make sure that your receivedMessage function returns true in order to continue to be called when you receive a new message. If it doesn't return true, it will only be called once and you will have to add it again via connection.addHandler().