Middleware for @xmpp/client
and @xmpp/component
.
Supports Node.js and browsers.
npm install @xmpp/middleware
const { Client } = require("@xmpp/client");
const middleware = require("@xmpp/middlware");
const client = new Client();
const app = middleware({ entity: client });
The use
method registers a middleware for incoming stanzas.
app.use((ctx, next) => {});
The filter
method registers a middleware for outgoing stanzas.
app.filter((ctx, next) => {});