Stripe Subscription Plugin

Plugin Development

Suggested Topics

  • 0 Votes
    4 Posts

    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/');

    you have to define the Server Sockets too

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

    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
    5 Posts

    @pichalite thanks ๐Ÿ‘ are these updates to match the latest version usually just little tweaks?

  • 2 Votes
    7 Posts

    @Tomas-Pavlacky seems that we will have to submit a PR to update those dependencies. Did you managed to make it work?

  • angular app plugin

    Plugin Development
    0 Votes
    14 Posts

    Issues ยท NodeBB/NodeBB

    Node.js based forum software built for the modern web - Issues ยท NodeBB/NodeBB


    GitHub (

    Don't forget to add as much information as you can ๐Ÿ™‚

  • 0 Votes
    3 Posts

    That error is caused by the following bit of code in src/plugins.js

    paths = { var parent = path.dirname(pluginLib); return cached.filter(function(libPath) { return libPath.indexOf(parent) !== -1; }); }).reduce(function(prev, cur) { return prev.concat(cur); });

    If paths is an empty array calling reduce will throw that error. We should add better checks to detect that.