https://github.com/unhappychoice/cycle-pusher
:recycle: Cycle.js driver for Pusher
https://github.com/unhappychoice/cycle-pusher
cyclejs library pusher typescript websocket wrapper
Last synced: 11 months ago
JSON representation
:recycle: Cycle.js driver for Pusher
- Host: GitHub
- URL: https://github.com/unhappychoice/cycle-pusher
- Owner: unhappychoice
- License: mit
- Created: 2017-10-24T12:14:24.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2025-04-08T04:04:12.000Z (about 1 year ago)
- Last Synced: 2025-04-08T05:19:57.351Z (about 1 year ago)
- Topics: cyclejs, library, pusher, typescript, websocket, wrapper
- Language: TypeScript
- Homepage:
- Size: 929 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-cyclejs - unhappychoice/cycle-pusher ★1 - A Cycle.js driver for [Pusher](https://pusher.com/) (Libraries / Drivers)
README
# cycle-pusher
[](https://badge.fury.io/js/cycle-pusher)
[](https://libraries.io/github/unhappychoice/cycle-pusher)



cycle-pusher is pusher client for [cycle.js](https://cycle.js.org/)
### Types
```typescript
const makePusherDirver = (app_key: string, configuration: Config): Driver, PusherSource>
interface PusherSource {
select(channelName: string, eventName: string): Stream;
}
interface PayloadOutput {
channelName: string;
eventName: string;
data: any;
}
interface PayloadInput {
channelName: string;
eventName: string;
data: any;
}
```
### Usage
```typescript
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](./LICENSE)