# phoenix-channels

> Phoenix Channels Client

Latest version **1.0.0** (published 2017-05-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install phoenix-channels
pnpm add phoenix-channels
yarn add phoenix-channels
bun add phoenix-channels
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2017-05-30 |
| First published | 2017-05-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 20 |
| Author | Chris McCord |
| Maintainers | mcampa |

## Links

- npm: https://www.npmjs.com/package/phoenix-channels
- Repository: https://github.com/mcampa/phoenix-client
- Homepage: https://github.com/mcampa/phoenix-client#readme
- Issues: https://github.com/mcampa/phoenix-client/issues
- npm.io page: https://npm.io/package/phoenix-channels

## Dependencies (1)

- [websocket](https://npm.io/package/websocket.md) ^1.0.24

## Recent versions

- 1.0.0 (latest) — 2017-05-30

## README

# Phoenix Channels Client
This is the Node.js client. If you need a client for the browser use [phoenix](https://www.npmjs.com/package/phoenix)

The differece with the original client is that this does not use long-polling and you need to pass the absolute url instead of the relative url.

# Usage
This uses the same API as the original [phoenix](https://www.npmjs.com/package/phoenix) except that it needs an absolute url
```javascript
const { Socket } = require('phoenix-channels')

let socket = new Socket("ws://example.com/socket")

socket.connect()

// Now that you are connected, you can join channels with a topic:
let channel = socket.channel("room:lobby", {})
channel.join()
  .receive("ok", resp => { console.log("Joined successfully", resp) })
  .receive("error", resp => { console.log("Unable to join", resp) })
```

`Presence` is also available

# Installation
`npm install --save phoenix-channels`

# Authors
API was made by authors of the [Phoenix Framework](http://www.phoenixframework.org/)
- see their website for complete list of authors.

Ported to Node.js by Mario Campa

# License

The same as [Phoenix Framework](http://www.phoenixframework.org/) (MIT)

---
_Source: https://npm.io/package/phoenix-channels · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
