cycle-pusher
TypeScript icon, indicating that this package has built-in type declarations

2.0.9 • Public • Published

cycle-pusher

npm version

cycle-pusher is pusher client for cycle.js

Types

const makePusherDirver = (app_key: string, configuration: Config): Driver<Stream<PayloadInput>, PusherSource>
 
interface PusherSource {
    select(channelName: string, eventName: string): Stream<any>;
}
 
interface PayloadOutput {
    channelName: string;
    eventName: string;
    data: any;
}
 
interface PayloadInput {
    channelName: string;
    eventName: string;
    data: any;
}

Usage

function main(sources) {
    const content$ = sources.pusher.select("channel1", "event1") // Receive messages
 
    const payload$ = Stream.of({ // Send messages
        channelName: "channel1",
        eventName: "client-event1",
        data: { "key": "value" }
    });
 
    return {
        pusher: payload$
    };
}
 
const app_key = "";
const config = { // See pusher document
    encrypted: true
};
 
run(main, {
    pusher: makePusherDirver(app_key, config)
});
 

see example directory for real usage.

License

see LICENSE

Readme

Keywords

Package Sidebar

Install

npm i cycle-pusher

Weekly Downloads

2

Version

2.0.9

License

MIT

Unpacked Size

16.7 kB

Total Files

21

Last publish

Collaborators

  • unhappychoice