[nodebb-plugin-codepen]Codepen Embedding

NodeBB Plugins

Suggested Topics


  • 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.

  • 5 Votes
    3 Posts
    470 Views

    Awesome.

    Thanks bunches for this. 👍

  • Imgur plugin upload error

    NodeBB Plugins
    0 Votes
    1 Posts
    895 Views

    I have the Imgur upload plugin installed, and enabled, but when I try to upload an image, I get "Upload Error: Invalid image path". Did I install it wrong?

    Edit: Just realized, I cloned the master branch and not the 5.x branch.

  • 0 Votes
    3 Posts
    2k Views

    Thank you @a_5mith, that's what I imagined but I think it's worth asking before putting some energy in that :).
    I'll follow your advice and take a look at other import plugins.
    Regards.

  • 1 Votes
    8 Posts
    3k Views

    @Shaun when 0.5.0 is released, their will be full documentation, but the process will be something along the lines of

    git checkout v0.5.x git pull ./nodebb upgrade

    But their will be an announcement about all of that and how to update when it's ready. If you have any other issues with plugins etc, feel free to create a topic. 👍