powered by Jive Software

Help xmpp.js interoperate with Openfire

Hello,

I am the author and maintainer of xmpp.js, a popular multi-platform JavaScript library for XMPP. A user opened an issue about being unable to use xmpp.js with OpenFire.

See https://github.com/xmppjs/xmpp.js/issues/889

I was able to reproduce the issue with starttls and direct tls but not with secure websocket. Here is a small reproduce test case.

I don’t use Openfire myself and I have limited time to dedicate to this, any help would be appreciated.

npm install @xmpp/client
NODE_TLS_REJECT_UNAUTHORIZED=0 node openfire.js
// openfire.js
const { client, xml } = require("@xmpp/client");

const xmpp = client({
  // direct TLS - affected
  // service: "xmpps://localhost:5223",
  // starttls - affected
  service: "xmpp://localhost:5222",
  // plain websocket - not affected
  // service: "ws://localhost:7070/ws",
  // secure websocket - not affected
  // service: "xmpp://localhost:744/ws",
  domain: "localhost",
  resource: "example",
  username: "admin",
  password: "*****",
});

xmpp.on("output", (data) => console.log("output\n", data));
xmpp.on("input", (data) => console.log("input\n", data));
xmpp.on("status", (status) => console.log("status", status));

xmpp.on("error", (err) => {
  console.error(err);
});

xmpp.on("offline", () => {
  console.log("offline");
});

xmpp.on("online", async (address) => {
  console.log("online as", address.toString());
  await xmpp.stop();
});

xmpp.start().catch(console.error);
1 Like