1.0.7 • Published 4 years ago

ezpubsub v1.0.7

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

EzPubSub

Simple Pub/Sub Messaging

Installation

npm install --save ezpubsub

Then:

import EzPubSub from 'ezpubsub';

If you're not using ES6 modules:

let EzPubSub = require('ezpubsub')

CDN

<script src="https://cdn.jsdelivr.net/npm/ezpubsub/dist/ezpubsub.min.js"></script>

Vue

import VueEzPubSub from 'ezpubsub/vue'

Usage

Initialization
let client = new EzPubSub('your-app-id',{
    key: 'your-app-key',
    secret: 'your-app-secret',
    cluster: 'your-app-cluster'
});
// Vue.js
Vue.use(VueEzPubSub,'your-app-id',{
    key: 'your-app-key',
    secret: 'your-app-secret',
    cluster: 'your-app-cluster'
})

You can get your app_id, key, secret and cluster from the EzPubSub.

Subscribe Channel
client.subscribeChannel('/my-channel', function(message) {
   alert(JSON.stringify(message));
});
// Vue.js
this.$ezpub.subscribeChannel('/my-channel', function(message) {
   alert(JSON.stringify(message));
});
Publish Channel
client.publishChannel('/my-channel', {
    text: 'Hello world'
});
// Vue.js
this.$ezpub.publishChannel('/my-channel', {
   text: 'Hello world'
});

Credits

  • All Contributors

License

The MIT License (MIT). Please see License File for more information.

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago