ah-broadcaster-plugin
action hero broadcaster plugin
Last updated 5 years ago by vapurfilozofu .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install ah-broadcaster-plugin 
SYNC missed versions from official npm registry.

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

Current Tags

  • 0.1.7                                ...           latest (5 years ago)

17 Versions

  • 0.1.7                                ...           5 years ago
  • 0.1.6                                ...           5 years ago
  • 0.1.5                                ...           5 years ago
  • 0.1.4                                ...           5 years ago
  • 0.1.3                                ...           5 years ago
  • 0.1.2                                ...           5 years ago
  • 0.1.1                                ...           5 years ago
  • 0.1.0                                ...           5 years ago
  • 0.0.9                                ...           5 years ago
  • 0.0.8                                ...           5 years ago
  • 0.0.7                                ...           6 years ago
  • 0.0.6                                ...           6 years ago
  • 0.0.5                                ...           6 years ago
  • 0.0.4                                ...           6 years ago
  • 0.0.3                                ...           6 years ago
  • 0.0.2                                ...           6 years ago
  • 0.0.1                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 2
This Month 2
Last Day 0
Last Week 3
Last Month 12
Dependencies (1)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |