Alexander Boroda
Alexander Boroda

Reputation: 11

Generate node-xmpp script for browser

I am developing an application on php. I need a chat on xmpp nodejs. Sending a message will go from web page.

I found enter link description here. In terminal everything works fine. But how do I attach client script to the browser?

I generate script by:browserify node_modules/node-xmpp/lib/node-xmpp-browserify.js > nodeXmpp.js and attach it to web page:

Then trying to use it:

$(document).ready(funcrion(){
var client = new XMPP.Client({
    jid: '[email protected]',
    password: 'password'
});

});

And chrome console telling me:

Cannot load StringPrep-0.2.3 bindings (using fallback). You may need to npm install node-stringprep nodeXmpp.js:3669

event.returnValue is deprecated. Please use the standard event.preventDefault() instead. jquery.js:3254

Uncaught TypeError: Object # has no method 'resolveSrv'

Object # - its "dns".

And before generate script i install node-stringprep.

Question is how build xmpp client script for browser.

Upvotes: 1

Views: 478

Answers (1)

jgillich
jgillich

Reputation: 76369

You didn't post your code, but the following should work fine:

require('node-xmpp/lib/node-xmpp-browserify.js');
var client = new XMPP.Client(opts);

Upvotes: 1

Related Questions