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.
- Public channels;
- Private channels;
- Presence channels;
- Client events;
- SSL on websocket and REST api;
- Complete REST api;
- Mimic pusher error codes;
- Simple console;
- Integration test using pusher-js or other client library;
- Web hooks;
- Specify types signature to functions and use dyalizer to check them;
Poxa is a standalone elixir server implementation of the Pusher protocol.
You need Elixir 0.9.0 at least and we need at least Erlang R16B.
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'
You can run and configure these values using this command:
elixir --erl "-poxa port 9090 -poxa app_id '<<"12345">>' -poxa app_key '<<"key-12345">>' -poxa app_secret '<<"secret6789">>'" -S mix run --no-halt
Or you can setup a configuration file like this:
test.config
[{poxa, [{port, 8080},
{app_id, <<"12345">>},
{app_key, <<"key-12345">>},
{app_secret, <<"secret6789">>}]}].
And run:
elixir --erl "-config test" -S mix run --no-halt
And if you want SSL, try something like this on your configuration file:
[{poxa, [{port, 8080},
{app_id, <<"app_id">>},
{app_key, <<"app_key">>},
{app_secret, <<"secret">>},
{ssl, [{port, 8443},
{cacertfile, "priv/ssl/server-ca.crt"},
{certfile, "priv/ssl/server.crt"},
{keyfile, "priv/ssl/server.key"}]}]}].
If you just want to run an executable, follow these instructions:
TODO
If you are using the pusher-gem:
Pusher.host = 'localhost'
Pusher.port = 8080
And pusher-js:
Pusher.host = 'localhost'
Pusher.ws_port = 8080
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.
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 meck to mock stuff. You can run the tests:
mix test
Pull requests are greatly appreciated.
Pusher is an excellent service and you should use it on production.