Socket
Book a DemoInstallSign in
Socket

ah-broadcaster-plugin

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ah-broadcaster-plugin

action hero broadcaster plugin

latest
Source
npmnpm
Version
0.1.7
Version published
Maintainers
1
Created
Source

ah-broadcaster-plugin

Helps broadcasting a message to every client connection in a channel. Most important difference from chat, it doesn't let clients broadcast anything to anyone.

How to install

npm install ah-broadcaster-plugin --save

Don't forget to enable plugin in action hero config (config/api.js).

How to use

There are three methods in this plugin: join, leave and broadcast.

api.channel.join (connection id, channel id, callback)

You can add any connection to a channel by id anytime you need.

api.channel.join(connection.id, 'my_channel');

api.channel.leave (connection id, channel id, callback)

You can remove any connection from a channel by id anytime you need.

api.channel.leave(connection.id, 'my_channel');

api.channel.broadcast (channel id, data, callback)

You can broadcast any message to a channel using this method.

api.channel.broadcast('my_channel', {message: 'hello'});

Try sending your message to channel "all" for boradcasting every client:

api.channel.broadcast('all', {message: 'hello'});

Keywords

action hero

FAQs

Package last updated on 31 Oct 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts