[nodebb-plugin-ali-oss] The Server and the OSS is not synchronous

Plugin Development

Suggested Topics


  • 0 Votes
    2 Posts
    124 Views

    Can you take a look at the runtime logs (sorry, I'm not fluent with Docker) and see what happens at the CMD node ./nodebb activate nodebb-plugin-my-plugin; node ./nodebb build; node ./nodebb start -l step?

    It sounds like maybe when ./nodebb start -l is run, NodeBB is doing another dependency install, which can happen if it detects some dependencies as out of date. That would effectively clobber your plugin that was copied into node_modules/

  • 0 Votes
    8 Posts
    629 Views

    @julian I have a block with a code in my profile, but the markdown does not work for a block with a code, only for plain text44d40b8f-0553-4ce2-b67f-7363edb19dc2-image.png

  • 0 Votes
    4 Posts
    650 Views

    I still have a question. Everything works fine at the moment. Send data from the client to the server isn't a problem now.

    But how can I emit a event to all connected clients serverside?

    Something e.g

    myPlugin.emit('plugins.publishMessage', {data: "Some data"}, function(err, result) { console.log(result); });

    After one hour spending searching different topics and some code I found the solution.

    Besides the custom clientside Sockets

    const myPluginSockets = require.main.require('./src/socket.io/plugins');

    you have to define the Server Sockets too

    const myPluginSockets = require.main.require('./src/socket.io/plugins'); const serverSockets = require.main.require('./src/socket.io');

    Now you can emit events from server side to the clients:

    serverSockets.server.sockets.emit('messageReceive', data);

    to receive the event clientside, you can use following in ur main.js file:

    socket.on('messageReceive', function(data){ console.log(data); });

    Client console output:
    {msg: "my message"}

    Maybe I'll write a little Tutorial on this because I am probably not the only one who does not understand it so easily.

  • 0 Votes
    6 Posts
    2k Views

    @Filozofer while the issue in discussion by @bentael and @baris is good, keep in mind it is still in development and can change at a moments notice!

  • 0 Votes
    3 Posts
    2k Views

    You can use Plugins.isActive method.