npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ember-phoenix-chan

v0.2.0

Published

Ember adapter mixins for Elixir Phoenix channels

Downloads

4

Readme

Ember Phoenix Chan

Elixir has a great web framework called Phoenix that ships with support for real-time communication (via sockets / long poll). Ember, being a front-end framework, can benefit a lot from gaining real-time capabilities.

This addon grabs phoenix.js from the Phoenix framework and puts it into your Ember app.

How to use

Directly import where needed:

import Phoenix from 'ember-phoenix-chan';
const {Socket, Channel, LongPoll, Ajax, Presence} = Phoenix;

To get started on building a Phoenix Elixir app, consult the good guide on Phoenix here:

http://www.phoenixframework.org/docs/channels

Chris McCord has written a good example of how to use the js sockets exposed by phoenix.js:

https://github.com/chrismccord/phoenix_chat_example/blob/master/web/static/js/app.js

The source code for phoenix.js is here:

https://github.com/phoenixframework/phoenix/blob/master/web/static/js/phoenix.js

Starting in Phoenix 1.2, you now have access to this thing called "Presence" which is some CRDT-based distributed state synchronization tool built natively into Phoenix. Read about it here:

https://hexdocs.pm/phoenix/1.2.0-rc.1/Phoenix.Presence.html#summary

Testing and Development

You'll need Elixir, Erlang, and the OTP on your local computer.

You can get those things at the elixir website:

http://elixir-lang.org/install.html

Once you have the tools for the backend, you can boot them up like so:

cd ..
npm install && bower install

# Alternatively, use ./bin/phoenix
cd bower_components/phoenix_chat_example
mix local.hex
mix deps.get
iex -S mix phoenix.server

ember s

And navigate to localhost:4200 in your browser.

In order to properly test, you'll need to open up 2 tabs. Try filling out the form and creating a new camera object, you'll see that it propages to the other tab nicely. Clicking on the created camera objects deletes them (this also propagates).

The reason this isn't automated is because it's a lot of work rigging out phantomjs (or Capybara) to use multiple tabs to test (lol), but I need this addon right now.

TODOs

  1. Implement query filtering in the channel-store
  2. Decouple phoenix.js from ChannelStore to allow for other WebSocket methods
  3. Rig up automated tests with either Phantom or Capybara
  4. More error handling and sensible error messages
  5. Conform to more of DDP's specifications
  6. Draw a mai-waifu-moe-am-i-kawaii-uguu~ logo

Installation

  • git clone this repository
  • npm install
  • bower install

Running

  • ember server
  • Visit your app at http://localhost:4200.

Running Tests

  • ember test
  • ember test --server

Building

  • ember build

For more information on using ember-cli, visit http://www.ember-cli.com/.