Files
kami-parse-server/src/Adapters/PubSub/PubSubAdapter.js
Florent Vilmart 942b9b5b1a Adds documentations for adapters and main constructors (#4951)
* wip

* Adds documentations for adapters, and constructors

* nits

* nit
2018-08-15 10:47:21 -04:00

50 lines
981 B
JavaScript

/*eslint no-unused-vars: "off"*/
/**
* @module Adapters
*/
/**
* @interface PubSubAdapter
*/
export class PubSubAdapter {
/**
* @returns {PubSubAdapter.Publisher}
*/
static createPublisher() {}
/**
* @returns {PubSubAdapter.Subscriber}
*/
static createSubscriber() {}
}
/**
* @interface Publisher
* @memberof PubSubAdapter
*/
interface Publisher {
/**
* @param {String} channel the channel in which to publish
* @param {String} message the message to publish
*/
publish(channel: string, message: string):void;
}
/**
* @interface Subscriber
* @memberof PubSubAdapter
*/
interface Subscriber {
/**
* called when a new subscription the channel is required
* @param {String} channel the channel to subscribe
*/
subscribe(channel: string): void;
/**
* called when the subscription from the channel should be stopped
* @param {String} channel
*/
unsubscribe(channel: string): void;
}
export default PubSubAdapter;