Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var net = require("net");
- var xmpp = require('node-xmpp');
- var server = net.createServer(
- function(socket) {
- socket.setEncoding("utf8");
- socket.on('data',function(data) {
- chat(data,socket);
- });
- }
- );
- server.listen(3000);
- var chat = function(data,socket) {
- var cl = new xmpp.Client({ jid: 'admin@mine',password: '12345' });
- cl.on('online',
- function() {
- cl.send(new xmpp.Element('message',
- { to: 'test@mine',
- type: 'chat'}).
- c('body').
- t(data));
- // nodejs has nothing left to do and will exit
- cl.end();
- });
- }
Add Comment
Please, Sign In to add comment