xmppstrapi

XMPPJS use xmpp in another js file?


I want send message to my XMPP server with my strapi API.

My connection to the XMPP is in index.js (and I can send messages here) and I want to send message from my controller is it possible ?

|index.js
|carrefour/
---|controllers/
   ---|carrefour.js

In index.js I have

module.exports = {
  register(/*{ strapi }*/) {},
  bootstrap(/*{ strapi }*/) {},
}

But if I add function or my xmpp object

[2022-10-11 16:54:05.824] error: Invalid file `./src/index.js`: this field has unspecified keys: myfunction

Thanks


Solution

  • I found an solution.

    I created a new JS in which I make my connection to the XMPP and then I export the xmpp variable