Awesome
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.
You should check this repository: https://github.com/edgurgel/poxa . There is a port of this project in Elixir and this repository won't be mantained in favor of the Elixir version.
Features
- Public channels;
- Private channels;
- Presence channels;
- Client events;
- SSL on websocket and REST api;
TODO
- 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;
- Split in rebar.config.test and rebar.config
Typical usage
Poxa is a standalone erlang server implementation of the Pusher protocol.
Clone this repository
Run
make deps 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:
erl -pa ebin deps/*/ebin -poxa port 9090 -poxa app_id '<<"12345">>' -poxa app_key '<<"key-12345">>' -poxa app_secret '<<"secret6789">>' -s poxa
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:
erl -pa ebin deps/*/ebin -config test -s poxa
And if you want SSL, try something like this:
[{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"}]}]}].
Release
If you just want to run an executable, follow these instructions:
TODO
Your application
If you are using the pusher-gem:
Pusher.host = 'localhost'
Pusher.port = 8080
And pusher-js:
Pusher.host = 'localhost'
Pusher.ws_port = 8080
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 erlang process) is "tagged" as {pusher, example-channel}. So 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.
You need Erlang and rebar. We are using Erlang R15B03, but you may try use it with other versions.
Dependencies can be fetched running:
make deps
To compile:
make
The test suite used is the simple EUnit and meck to mock stuff. You can run the tests:
make test
Pull requests are greatly appreciated.
Pusher
Pusher is an excellent service and you should use it on production.