• Stars
    star
    1,035
  • Rank 44,530 (Top 0.9 %)
  • Language
    Elixir
  • License
    MIT License
  • Created over 11 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Pusher server implementation compatible with Pusher client libraries.

Build Status Inline docs Release Docker

Poxa

Open Pusher implementation compatible with Pusher libraries. It's designed to be used as a single registered app with id, secret and key defined on start.

How do I speak 'poxa'?

['poʃa] - Phonetic notation

[posha] : po ( potion ), sha ( shall )

Features

  • Public channels;
  • Private channels;
  • Presence channels;
  • Client events;
  • SSL on websocket and REST API;
  • Simple console;
  • REST API
    • /users on presence channels
    • /channels/:channel_name
    • /channels

Development

Poxa is a standalone elixir server implementation of the Pusher protocol.

You need Elixir 1.9 at least and Erlang 21.0

Clone this repository

Run

mix deps.get
mix compile

The default configuration is:

  • Port: 8080
  • App id: 'app_id'
  • App key: 'app_key'
  • App secret: 'secret'

Using Docker

Docker images are automatically built by Docker Hub. They are available at Docker Hub: https://hub.docker.com/r/edgurgel/poxa-automated/tags/

One can generate it using: docker build -t local/poxa ..

The docker run command should look like this:

docker run --rm --name poxa -p 8080:8080 edgurgel/poxa-automated:latest

Configuration

The following environment variables are supported:

  • PORT
  • POXA_APP_KEY
  • POXA_SECRET
  • POXA_APP_ID
  • POXA_REGISTRY_ADAPTER
  • WEB_HOOK
  • ACTIVITY_TIMEOUT
  • POXA_SSL
  • SSL_PORT
  • SSL_CACERTFILE
  • SSL_CERTFILE
  • SSL_KEYFILE

Your application

If you are using the pusher-gem:

Pusher.host   = 'localhost'
Pusher.port   = 8080

And pusher-js:

// will only use WebSockets
var pusher = new Pusher(APP_KEY, {
  wsHost: 'localhost',
  wsPort: 8080,
  enabledTransports: ["ws", "flash"],
  disabledTransports: ["flash"]
});

A working poxa is on http://poxa.herokuapp.com, with:

  • App key: "app_key"
  • App id: "app_id"
  • App secret: "secret"
  • Port: 80

Also a pusher example(https://github.com/pusher/pusher-presence-demo) is running using poxa at: http://poxa-presence-chat.herokuapp.com/

Console

A simple console is available on index:

Console

You can see it in action on http://poxa.herokuapp.com using "app_key" and "secret" to connect. Now open the poxa-presence-chat and watch events happening!

Implementation

Poxa uses gproc extensively to register websocket connections as channels. So, when a client subscribes for channel 'example-channel', the websocket connection (which is a elixir process) is "tagged" as {pusher, example-channel}. When a pusher event is triggered on the 'example-channel', every websocket matching the tag receives the event.

Contributing

If you'd like to hack on Poxa, start by forking my repo on Github.

Dependencies can be fetched running:

MIX_ENV=dev mix deps.get

Compile:

mix compile

The test suite used is the ExUnit and Mimic to mock stuff.

To run tests:

mix test

Pull requests are greatly appreciated.

TODO

  • SockJS support;
  • Complete REST api;
  • Mimic pusher error codes;
  • Integration test using pusher-js or other client library;
  • Web hooks;
  • Add 'Vacated' and 'Occupied' events to Console;
  • Use gproc to generate Console events so other handlers can be attached (Web hook for example);
  • Turn Poxa on a distributed server with multiple nodes;

Pusher

Pusher is an excellent service and you should use it in production.

Acknowledgements

Thanks to @bastos for the project name ❤️!

Who is using it?

More Repositories

1

httpoison

Yet Another HTTP client for Elixir powered by hackney
Elixir
2,218
star
2

verk

A job processing system that just verks! 🧛‍
Elixir
721
star
3

tentacat

Simple Elixir wrapper for the GitHub API
Elixir
443
star
4

mimic

A mocking library for Elixir
Elixir
386
star
5

solid

Liquid template engine in Elixir
Elixir
201
star
6

CMNavBarNotificationView

[unmaintained] An in-app notification view above the navigation bar "totally" based on MPNotificationView
Objective-C
124
star
7

httparrot

HTTP Request & Response Server. An incomplete clone of http://httpbin.org
Elixir
85
star
8

verk_web

A dashboard for the job processing system that just verks! 🧛‍
JavaScript
81
star
9

bertex

Elixir BERT encoder/decoder
Elixir
30
star
10

poxa-erlang

Open Pusher server implementation compatible with Pusher libraries.
Erlang
26
star
11

signaturex

Simple key/secret based authentication for APIs
Elixir
26
star
12

pusher

Elixir library to access the Pusher REST API.
Elixir
26
star
13

riex

[OLD] Riak & Elixir in a pool
Elixir
23
star
14

tldr_elixir_client

Elixir command line client for tldr
Elixir
15
star
15

wth

WTH is a command line tool much like old WTF that searchs on Urban Dictionary for a term definition.
Elixir
15
star
16

httpehaviour

Yet yet another HTTP client. This time using Behaviour
Elixir
14
star
17

watcher

GenEvent Watcher
Elixir
13
star
18

bertrpcex

A pool of BERT-RPC clients built on top of poolboy
Elixir
12
star
19

CMSignals

Qt Signals and Slots clone to Objective-C.
Objective-C
12
star
20

pusher_client

A websocket client to work with Pusher
Elixir
10
star
21

verk-stats

Verk Stats 🧛‍📊
Elixir
4
star
22

bertrpc

A pool of BERT-RPC clients build on top of poolboy.
Erlang
3
star
23

defpool

Elixir macro to use pooler on a clean way
Elixir
2
star
24

compiz-plugins-ideas

Some ideas for new compiz plugins
C
1
star