ProductPromotion
Logo

Elixir

made by https://0x3d.site

GitHub - edgurgel/poxa: Pusher server implementation compatible with Pusher client libraries.
Pusher server implementation compatible with Pusher client libraries. - edgurgel/poxa
Visit Site

GitHub - edgurgel/poxa: Pusher server implementation compatible with Pusher client libraries.

GitHub - edgurgel/poxa: Pusher server implementation compatible with Pusher client libraries.

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.16 at least and Erlang 26.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 https://poxa.onrender.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 :heart:!

Who is using it?

Articles
to learn more about the elixir concepts.

Resources
which are currently available to browse on.

mail [email protected] to add your project or resources here 🔥.

FAQ's
to know more about the topic.

mail [email protected] to add your project or resources here 🔥.

Queries
or most google FAQ's about Elixir.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory