Skip to content

pushex-project/pushex

Repository files navigation

PushEx

Hex.pm Hex.pm Hex.pm Build Status

PushEx is an implementation of Phoenix Channels which handles best practices of running WebSockets for you, but allows your business logic to be specified through simple behaviour modules.

PushEx is in use at SalesLoft, powering a large amount of pushes per day. It has been stable since early 2019, with no operational incidents.

Key Links

Features

  • Push socket/channel implementation
  • Push API implementation
  • Customizable hook points to allow authentication and instrumentation
  • Designed for performance with a large number of connections and messages
  • JS client built on top of Phoenix.js

Compared to Phoenix

PushEx is built on top of Phoenix Channel and Presence. If you look at the source code, it is actually a very thin layer on top of this core functionality; most of the code is around ensuring a scalable system which is set up for success without knowing how Phoenix works.

PushEx is better compared to a pre-built microservice that is ready to go. By implementing a few application specific functions, you can bring a fully baked push WebSocket server to your application. You will also benefit from community upgrades regarding functionality and performance; this is true both for Phoenix changes and PushEx changes. You do not need to know how Phoenix works in order to build a scalable system.

Get Started

The best way to get started is by following the Standalone Installation Guide.

It is possible to integrate PushEx with an existing Phoenix application, although this is not recommended for applications which are deployed often. The installation guide for this case is slated for the future. Please open an issue if you'd like it for your use case.

The PushEx docs contain many guides such as authentication, deployment, instrumentation, PushEx.js, PubSub, API usage. Please see this guide for up to date information. You can also access these guides in the repo folder guides.

Current Version

Add the following to your mix.exs deps in order to get the latest version of PushEx:

  {:push_ex, "~> 2.1.0"},

Examples

Examples are located in the examples directory. The test_frontend_socket example is the most complete and simple example.

Company Sponsor

A big thanks to SalesLoft for helping with the development and open-sourcing of PushEx. Their support of my professional and personal time into this project (it was formed in an Innovation Week) is the type of thing that makes them Atlanta's best place to work.

Real-Time Phoenix Book

Consider checking out my book Real-Time Phoenix if you are interested in writing real-time systems in Elixir.