javascript - How to send chat messages using converse library -


i using openfire xmpp server , using converse client library. want send chat message chat window openfire. want send text converse method send message xmpp server. trying send message using following:

var msg = converse.env.$msg({       from: 'a1@localhost',       to: 'a6@localhost',       type: 'chat',       body: "hi"    });    converse.send(msg); 

but sends following frame in network of console in websocket:

message from='a1@localhost' to='a6@localhost' type='chat' body='hi' xmlns='jabber:client'/>

this not transfer message other user neither stores in table. pretty sure calling wrong function. can povide help.

you calling right function.

what you'll miss:

  1. listener of messages in "a6@localhost" client: read in documentation there few functions

  2. probably, right name of server. "localhost" has problem. can check openfire real service name on own web panel

  3. to check if message it's delivered in openfire you'll can check of's log (check debug one, you'll have enable it). real time messages not stored on database, groupchat's ones , not everytime , offline messages. not find them on db means nothing

https://conversejs.org/docs/html/development.html

converse.chats.open('buddy@example.com'); converse.chats.get('buddy@example.com'); converse.listen.on('message', function (event, messagexml) { ... }); 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -