JSPM

phoenix-channels

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 797
  • Score
    100M100P100Q146022F
  • License MIT

Phoenix Channels Client

Package Exports

  • phoenix-channels

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (phoenix-channels) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Phoenix Channels Client

This is the Node.js client. If you need a client for the browser use 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 except that it needs an absolute url

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

  • see their website for complete list of authors.

Ported to Node.js by Mario Campa

License

The same as Phoenix Framework (MIT)