javascript - How to auto open a chat in XMPP chat client Converse.js -
i want integrate xmpp chat website. tried create bare bone chat, should auto login , auto open chat window. can auto login, nothing after that.
the whole code below. why not auto open chat window?
<body> <script> converse.initialize({ show_controlbox_by_default: true, allow_muc: false, show_controlbox_by_default: true, auto_login: true, authentication: 'login', jid: 'kelvin@xmpp.mydomainhere.com', password: 'kelvin', websocket_url: 'wss://xmpp.mydomainhere.com:5280/websocket' }); console.log("000"); converse.plugins.add('myplugin', { initialize: function () { this._converse.chats.open('jacky@xmpp.mydomainhere.com') var msg = converse.env.$msg({ from: 'kelvin@xmpp.mydomainhere.com', to:'jacky@xmpp.mydomainhere.com', type:'chat' }); this._converse.send(msg); } }); </script> </body>
from version 3.0.0 , onwards, plugins need whitelisted (via whitelisted_plugins setting), otherwise not initialized.
so have add whitelisted_plugins: ['myplugin']
converse.initialize
call.
besides that, need register plugin before calling converse.initialize
.
Comments
Post a Comment