Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 23 days 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 (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-10-09T08:05:50.000Z (28 days ago)
- Last Synced: 2024-10-11T13:37:13.056Z (26 days ago)
- Topics: cyclejs, library, pusher, typescript, websocket, wrapper
- Language: TypeScript
- Homepage:
- Size: 1.08 MB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# cycle-pusher
[![npm version](https://badge.fury.io/js/cycle-pusher.svg)](https://badge.fury.io/js/cycle-pusher)
[![Libraries.io dependency status for GitHub repo](https://img.shields.io/librariesio/github/unhappychoice/cycle-pusher.svg)](https://libraries.io/github/unhappychoice/cycle-pusher)
![npm bundle size](https://img.shields.io/bundlephobia/min/cycle-pusher.svg)
![npm](https://img.shields.io/npm/dt/cycle-pusher.svg)
![GitHub](https://img.shields.io/github/license/unhappychoice/cycle-pusher.svg)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 messagesconst 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)