- Notifications
You must be signed in to change notification settings - Fork100
Pusher server implementation compatible with Pusher client libraries.
License
edgurgel/poxa
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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 )
- 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
Poxa is a standalone elixir server implementation of the Pusher protocol.
You needElixir 1.16 at least and Erlang 26.0
Clone this repository
Run
mix deps.getmix compile
The default configuration is:
- Port: 8080
- App id: 'app_id'
- App key: 'app_key'
- App secret: 'secret'
Docker images are automatically built byDocker 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 .
.
Thedocker run
command should look like this:
docker run --rm --name poxa -p 8080:8080 edgurgel/poxa-automated:latest
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
If you are using the pusher-gem:
Pusher.host='localhost'Pusher.port=8080
And pusher-js:
// will only use WebSocketsvarpusher=newPusher(APP_KEY,{wsHost:'localhost',wsPort:8080,enabledTransports:["ws","flash"],disabledTransports:["flash"]});
A working poxa is onhttps://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/
A simple console is available on index:
You can see it in action onhttp://poxa.herokuapp.com using "app_key" and "secret" to connect. Now open thepoxa-presence-chat and watch events happening!
Poxa usesgproc 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.
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 andMimic to mock stuff.
To run tests:
mix test
Pull requests are greatly appreciated.
- 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 is an excellent service and you should use it in production.
Thanks to@bastos for the project name ❤️!
- Waffle Takeout
- Tinfoil Security
- Add your project/service here! Send a PR! 🎉
About
Pusher server implementation compatible with Pusher client libraries.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.