Code Monkey home page Code Monkey logo

poxa's People

Contributors

allyraza avatar burtonjc avatar cbliard avatar darrencauthon avatar dependabot-preview[bot] avatar edgurgel avatar fernandodev avatar haver33 avatar hendrikhofstadt avatar iurifq avatar joshk avatar jtslear avatar kianmeng avatar letmein avatar lowks avatar quinnwilton avatar rrrene avatar therusskiy avatar tobycox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

poxa's Issues

Signaturex validation issue

I've used previous versions of Poxa with no issue, but installing a later one (0.1.0) has had some trouble.

I thought it was an issue with the pusher gem (using Ruby to trigger events), but I realized that I was getting the same errors when I tried to log in to the Poxa site. I'd enter the credentials at the top, then it would error.

I was able to get that page, and my own code, to work by commenting out this line:

Signaturex.validate!(app_key, secret, method, path, qs_vals, 600)

So it is failing this check, but why?

I've seen this same issue on my own computer (OSX) and on an Ubuntu 12.04 server. Browser was latest the latest Chrome, in Incognito Mode.

I'm still going to investigate, but in case there's an "aha!" moment from someone else or in case someone can point out the dumb thing I'm doing... let me know.

I'll update as I figure things out.

18:05:43.442 [error] Error in process <0.408.0> with exit value: {[{reason,undef},{mfa,{'Elixir.Poxa.Console.WSHandler',websocket_init,3}},{stacktrace,[{'Elixir.String','from_char_data!',["0642ea1a44776ea4f5cd06449e35bc48766efea68767dd70ec6fb225f379ecf3"],[]},{'Elixir.Signaturex','validate_signature!'...

18:05:43.443 [error] Ranch listener http had connection process started with cowboy_protocol:start_link/4 at <0.408.0> exit with reason: {[{reason,undef},{mfa,{'Elixir.Poxa.Console.WSHandler',websocket_init,3}},{stacktrace,[{'Elixir.String','from_char_data!',["0642ea1a44776ea4f5cd06449e35bc48766efea68767dd70ec6fb225f379ecf3"],[]},{'Elixir.Signaturex','validate_signature!',5,[{file,"lib/signaturex.ex"},{line,68}]},{'Elixir.Signaturex','validate!',6,[{file,"lib/signaturex.ex"},{line,18}]},{'Elixir.Poxa.Authentication',check,4,[{file,"lib/poxa/authentication.ex"},{line,21}]},{'Elixir.Poxa.Console.WSHandler',websocket_init,3,[{file,"lib/poxa/console/console_ws_handler.ex"},{line,13}]},{cowboy_websocket,handler_init,3,[{file,"src/cowboy_websocket.erl"},{line,140}]},{cowboy_protocol,execute,4,[{file,"src/cowboy_protocol.erl"},{line,529}]}]},{req,[{socket,#Port<0.9499>},{transport,ranch_tcp},{connection,keepalive},{pid,<0.408.0>},{method,<<"GET">>},{version,'HTTP/1.1'},{peer,{{127,0,0,1},49312}},{host,<<"localhost">>},{host_info,undefined},{port,3003},{path,<<"/console">>},{path_info,undefined},{qs,<<"auth_key=b&auth_timestamp=1407452743&auth_version=1.0&auth_signature=0642ea1a44776ea4f5cd06449e35bc48766efea68767dd70ec6fb225f379ecf3">>},{qs_vals,undefined},{bindings,[]},{headers,[{<<"upgrade">>,<<"websocket">>},{<<"connection">>,<<"Upgrade">>},{<<"host">>,<<"localhost:3003">>},{<<"origin">>,<<"http://localhost:3003">>},{<<"pragma">>,<<"no-cache">>},{<<"cache-control">>,<<"no-cache">>},{<<"sec-websocket-key">>,<<"KxC7fXzrmSgoQefBCeykOQ==">>},{<<"sec-websocket-version">>,<<"13">>},{<<"sec-websocket-extensions">>,<<"permessage-deflate; client_max_window_bits, x-webkit-deflate-frame">>},{<<"user-agent">>,<<"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36">>}]},{p_headers,[{<<"sec-websocket-extensions">>,[{<<"permessage-deflate">>,[<<"client_max_window_bits">>]},{<<"x-webkit-deflate-frame">>,[]}]},{<<"upgrade">>,[<<"websocket">>]},{<<"connection">>,[<<"upgrade">>]}]},{cookies,undefined},{meta,[{websocket_compress,false},{websocket_version,13}]},{body_state,waiting},{multipart,undefined},{buffer,<<>>},{resp_compress,false},{resp_state,waiting},{resp_headers,[]},{resp_body,<<>>},{onresponse,undefined}]},{opts,[]}],[{cowboy_protocol,execute,4,[{file,"src/cowboy_protocol.erl"},{line,529}]}]}

help building

Hey, I'm brand new to erlang/elixir - setting up a fresh machine to try to build this on;

I did a brew install erlang, got the newest elixir in my path

mix deps.get <- worked

But then fails on lager;

[troy@Macintosh poxa (master)]$ mix compile
warning: the dependency jsex requires Elixir "~> 0.12.3" but you are running on v0.13.0, please run mix deps.update jsex to update it
* Compiling gproc
==> gproc (compile)
Compiled src/gproc_pt.erl
Compiled src/gproc_app.erl
Compiled src/gproc_bcast.erl
Compiled src/gproc_info.erl
Compiled src/gproc_init.erl
Compiled src/gproc_lib.erl
Compiled src/gproc_monitor.erl
src/gproc_dist.erl:23: Warning: behaviour gen_leader undefined
Compiled src/gproc_dist.erl
Compiled src/gproc_ps.erl
Compiled src/gproc_sup.erl
Compiled src/gproc_pool.erl
Compiled src/gproc.erl
* Compiling ranch
==> ranch (compile)
Compiled src/ranch_protocol.erl
Compiled src/ranch_transport.erl
Compiled src/ranch_acceptor.erl
Compiled src/ranch_acceptors_sup.erl
Compiled src/ranch_app.erl
Compiled src/ranch_listener_sup.erl
Compiled src/ranch.erl
Compiled src/ranch_server.erl
Compiled src/ranch_sup.erl
Compiled src/ranch_conns_sup.erl
Compiled src/ranch_tcp.erl
Compiled src/ranch_ssl.erl
* Compiling jsx
==> jsx (compile)
Compiled src/jsx.erl
Compiled src/jsx_config.erl
Compiled src/jsx_decoder.erl
Compiled src/jsx_to_json.erl
Compiled src/jsx_to_term.erl
Compiled src/jsx_verify.erl
Compiled src/jsx_encoder.erl
Compiled src/jsx_parser.erl
* Compiling jsex
Compiled lib/jsex.ex
Generated jsex.app
* Compiling cowlib
==> cowlib (compile)
Compiled src/cow_http.erl
Compiled src/cow_cookie.erl
Compiled src/cow_date.erl
Compiled src/cow_qs.erl
Compiled src/cow_spdy.erl
Compiled src/cow_mimetypes.erl
* Compiling cowboy
==> cowboy (compile)
Compiled src/cowboy_http_handler.erl
Compiled src/cowboy_loop_handler.erl
Compiled src/cowboy_middleware.erl
Compiled src/cowboy_sub_protocol.erl
Compiled src/cowboy_websocket_handler.erl
Compiled src/cowboy_app.erl
Compiled src/cowboy.erl
Compiled src/cowboy_bstr.erl
Compiled src/cowboy_clock.erl
Compiled src/cowboy_client.erl
Compiled src/cowboy_handler.erl
Compiled src/cowboy_multipart.erl
Compiled src/cowboy_protocol.erl
Compiled src/cowboy_http.erl
Compiled src/cowboy_router.erl
Compiled src/cowboy_spdy.erl
Compiled src/cowboy_static.erl
Compiled src/cowboy_sup.erl
Compiled src/cowboy_rest.erl
Compiled src/cowboy_req.erl
Compiled src/cowboy_websocket.erl
* Compiling uuid
cp src/uuid.app.src ebin/uuid.app
erl -make
Recompile: src/uuid
* Compiling goldrush
==> goldrush (compile)
Compiled src/glc.erl
Compiled src/glc_lib.erl
Compiled src/glc_code.erl
Compiled src/gr_context.erl
Compiled src/glc_ops.erl
Compiled src/gre.erl
* Compiling lager
==> lager (compile)
Compiled src/lager_util.erl
Compiled src/lager_transform.erl
Compiled src/lager_app.erl
Compiled src/lager_backend_throttle.erl
Compiled src/lager.erl
Compiled src/lager_config.erl
Compiled src/lager_console_backend.erl
Compiled src/error_logger_lager_h.erl
Compiled src/lager_crash_log.erl
Compiled src/lager_default_formatter.erl
Compiling src/lager_file_backend.erl failed:
src/lager_file_backend.erl:503: cannot parse file, giving up
ERROR: compile failed while processing /Users/troy/Documents/projects/erlang/poxa/deps/lager: rebar_abort
** (Mix) Could not compile dependency lager, /Users/troy/v0.13.0/bin/rebar command failed. If you want to recompile this dependency, please run: mix deps.compile lager

I don't know if that is a symptom, but doing what it said next got a little further;

[troy@Macintosh poxa (master %)]$ mix deps.compile lager
warning: the dependency jsex requires Elixir "~> 0.12.3" but you are running on v0.13.0, please run mix deps.update jsex to update it
* Compiling lager
Could not find rebar, which is needed to build lager
I can install a local copy which is just used by mix
Shall I install this local copy? [Yn] y
* creating /Users/troy/.mix/rebar
==> lager (compile)
src/lager_file_backend.erl:503: cannot parse file, giving up
ERROR: compile failed while processing /Users/troy/Documents/projects/erlang/poxa/deps/lager: rebar_abort
** (Mix) Could not compile dependency lager, /Users/troy/.mix/rebar command failed. If you want to recompile this dependency, please run: mix deps.compile lager

Then I'm stuck - I couldn't find anything online about this last error

Any ideas? Feel free to close this if it's too far off topic for this app

Unknown server protocol version

I'm trying to use the .NET pusher client and I'm having some problems.

Like this:

Pusher Warning: 0 : Websocket connection has been closed
Pusher Error: 0 : Error: System.Exception: unknown server protocol version

From what I understand, the problem is the Sec-WebSocket-Version header. The error happens on the WebSocket4Net library:

private const string m_WebSocketVersion = "Sec-WebSocket-Version";
...
if (string.IsNullOrEmpty(websocketVersion))
{
    session.FireError(new Exception("unknown server protocol version"));
    session.CloseWithoutHandshake();
    return;
}

I don't know if this is a Poxa problem or some bug on the .NET Client. Do you have any information that can help me?

The docker run command suggested in the readme don't work

The readme suggests this command:

docker run --rm -p 8080:8080 -v $PWD/mypoxa.conf:/app/releases/0.4.2/poxa.conf edgurgel/poxa:0.4.2

For me, this ends up in this error:

Cannot start container d8a46ec73d1578c9cb3888b2a1011b2da28d122b9d24bbcd7394b17a0f518e41: [8] System error: not a directory

AFAIK, the -v option is used to mount directories, not files. (Docker Run Command Line reference).

I have no experience with docker, so, I'm unable to make this works with run command. Some references that I found says that we have to use the cp command. The easy way I found to make this work was create my own image with a dockerfile like this:

FROM edgurgel/poxa:0.4.3

ADD ./poxa.conf /app/releases/0.4.3/poxa.conf

EXPOSE 80

as explained here

I am using Docker version 1.8.1, build d12ea79

Add 'Vacated' and 'Occupied' events

We need these events to properly send webhook and console events. Right now the implementation may not warn if the channel is actually vacated or not.

Getting "erlexec: HOME must be set" error when trying to run with supervisord

I'm trying to run poxa with supervisord, because for some reason occasionally poxa will just die after a few weeks.

When I run it from the cli it just works.
But when running it through supervisord, it will output:
"/home/ludohelder/poxa/rel/poxa/bin/poxa: 79: /home/ludohelder/poxa/rel/poxa/bin/poxa: /erts-6.4/bin/escript: not founderlexec: HOME must be set"

This is my supervisord conf file

[program:poxa]
process_name=poxa_supervisord
command=/home/ludohelder/poxa/rel/poxa/bin/poxa start
autostart=true
autorestart=true
numprocs=1
environment=HOME="/home/ludohelder"

I actually added the last line recently, to try to fix the "HOME must be set error" but it doesn't work.

Rethink what should be logged

Right now there are some Logger.info calls around but no real thought around what should or should not be logged.

What should we log?

This will be also a good starting point to think about which metrics would be interesting to gather and send through something like exometer.

Changing App Key and App Secret does not work

I am new to this project.

I forked the repository, changed the poxa.conf with a new created app_id, app_key and secret and deployed it on Heroku. The new app_key, secret does not work on the new server and the interface. However, the default variables work, even though poxa.conf was changed.

What am I missing? Would appreciate any guidance.

Feature request: Performance - scalability info & load tests

I've been watching and trying different implementations of Pusher.

Slanger (https://github.com/stevegraham/slanger) seems to scale really well as you can launch as many nodes as you want and they will use Redis to share channel state. But Slanger is not in such active development as Poxa is, and some features are missing. I am very glad to have found Poxa.

It would be awesome to have some info on how well Poxa could scale, maybe some performance info about tests against a single Heroku dyno and updating the README with this.

Another thing that I find very useful (and I couldn't find anything like it) would be a simple tool that would load test Poxa, with just a few params like number of channels to generate, number of connections (users) per channel and the ratio in which this connetions are stablished.

The data I am more curious about is how many simultaneous users (open websockets connections) can a single heroku dyno or an Amazon t3.micro instance handle.

Thanks for sharing this implementation!

Using Pusher JS

Hello,
I have been looking at this a bit more and trying to use Pusher JS.

A couple of issues, When I use the following to initialise the presence app, it gives me a app does not exist error:

  var pusher = new Pusher('presence-demo', {
  wsHost: 'poxa.herokuapp.com',
  wsPort: 80,
  enabledTransports: ["ws", "flash"],
  disabledTransports: ["flash"]
});

Pusher.com uses API keys, how can one use the APP_ID, APP_KEY and APP_SECRET using Pusher-js?

Add support to configs via environment variables

To use the docker image, I have to create a config file and copy it to the container (like this). It would be easier (maybe better) to configure this settings by environment variables.

I'm deploying to AWS Elastic Beanstalk and If it were possible to configure by environment variables I will be able to get the app up and running just by configuring the env vars on AWS Console and creating a file like this:

Dockerrun.aws.json

{
  "AWSEBDockerrunVersion": "1",
  "Image": {
    "Name": "edgurgel/poxa",
    "Update": "true"
  },
  "Ports": [
    {
      "ContainerPort": "8080"
    }
  ],
  "Logging": "/var/log/nginx"
}

I'm new to Elixir, so, I'm not familiar with Mix. From what I understand, the config.exs file is already getting some configs from env vars, but, this code is executed only on docker image generation command is executed (MIX_ENV=prod mix edip --prefix edgurgel) and not on the application initialization. So, it doesn't help who is trying to use the docker image. Right?

Does not deploy to Heroku

Currently cannot deploy via the 'Deploy to Heroku' badge. Probably something to do with the recent Heroku stack changes. Log below.

-----> Fetching custom git buildpack... done
-----> elixir app detected
-----> Checking Erlang and Elixir versions
       Will use the following versions:
       * Erlang 17.0
       * Elixir 1.0.0 
       Will export the following config vars:
       * Config vars DATABASE_URL
-----> Stack changed, will rebuild
-----> Fetching Erlang 17.0
-----> Installing Erlang 17.0

-----> Fetching Elixir v1.0.0
-----> Installing Elixir v1.0.0
-----> Installing Hex
2014-11-09 05:13:39 URL:https://s3.amazonaws.com/s3.hex.pm/installs/hex.ez [240877/240877] -> "/tmp/hex.ez" [1]
* creating .mix/archives/hex.ez
-----> Installing rebar
* creating .mix/rebar
-----> Fetching app dependencies with mix
* Getting uuid (git://github.com/avtobiff/erlang-uuid.git)
Cloning into '/tmp/build_184a518ebab07e9a86fe35b5b6bd32e5/edgurgel-poxa-39e039c/deps/uuid'...
remote: Counting objects: 450, done.        
Receiving objects:   0% (1/450)   
Receiving objects:   1% (5/450)   
Receiving objects:   2% (9/450)   
Receiving objects:   3% (14/450)   
Receiving objects:   4% (18/450)   
Receiving objects:   5% (23/450)   
Receiving objects:   6% (27/450)   
Receiving objects:   7% (32/450)   
Receiving objects:   8% (36/450)   
Receiving objects:   9% (41/450)   
Receiving objects:  10% (45/450)   
Receiving objects:  11% (50/450)   
Receiving objects:  12% (54/450)   
Receiving objects:  13% (59/450)   
Receiving objects:  14% (63/450)   
Receiving objects:  15% (68/450)   
Receiving objects:  16% (72/450)   
Receiving objects:  17% (77/450)   
Receiving objects:  18% (81/450)   
Receiving objects:  19% (86/450)   
Receiving objects:  20% (90/450)   
Receiving objects:  21% (95/450)   
Receiving objects:  22% (99/450)   
Receiving objects:  23% (104/450)   
Receiving objects:  24% (108/450)   
Receiving objects:  25% (113/450)   
Receiving objects:  26% (117/450)   
Receiving objects:  27% (122/450)   
Receiving objects:  28% (126/450)   
Receiving objects:  29% (131/450)   
Receiving objects:  30% (135/450)   
Receiving objects:  31% (140/450)   
Receiving objects:  32% (144/450)   
Receiving objects:  33% (149/450)   
Receiving objects:  34% (153/450)   
Receiving objects:  35% (158/450)   
Receiving objects:  36% (162/450)   
Receiving objects:  37% (167/450)   
Receiving objects:  38% (171/450)   
Receiving objects:  39% (176/450)   
Receiving objects:  40% (180/450)   
Receiving objects:  41% (185/450)   
Receiving objects:  42% (189/450)   
Receiving objects:  43% (194/450)   
Receiving objects:  44% (198/450)   
Receiving objects:  45% (203/450)   
Receiving objects:  46% (207/450)   
Receiving objects:  47% (212/450)   
Receiving objects:  48% (216/450)   
remote: Total 450 (delta 0), reused 0 (delta 0)        
Receiving objects:  49% (221/450)   
Receiving objects:  50% (225/450)   
Receiving objects:  51% (230/450)   
Receiving objects:  52% (234/450)   
Receiving objects:  53% (239/450)   
Receiving objects:  54% (243/450)   
Receiving objects:  55% (248/450)   
Receiving objects:  56% (252/450)   
Receiving objects:  57% (257/450)   
Receiving objects:  58% (261/450)   
Receiving objects:  59% (266/450)   
Receiving objects:  60% (270/450)   
Receiving objects:  61% (275/450)   
Receiving objects:  62% (279/450)   
Receiving objects:  63% (284/450)   
Receiving objects:  64% (288/450)   
Receiving objects:  65% (293/450)   
Receiving objects:  66% (297/450)   
Receiving objects:  67% (302/450)   
Receiving objects:  68% (306/450)   
Receiving objects:  69% (311/450)   
Receiving objects:  70% (315/450)   
Receiving objects:  71% (320/450)   
Receiving objects:  72% (324/450)   
Receiving objects:  73% (329/450)   
Receiving objects:  74% (333/450)   
Receiving objects:  75% (338/450)   
Receiving objects:  76% (342/450)   
Receiving objects:  77% (347/450)   
Receiving objects:  78% (351/450)   
Receiving objects:  79% (356/450)   
Receiving objects:  80% (360/450)   
Receiving objects:  81% (365/450)   
Receiving objects:  82% (369/450)   
Receiving objects:  83% (374/450)   
Receiving objects:  84% (378/450)   
Receiving objects:  85% (383/450)   
Receiving objects:  86% (387/450)   
Receiving objects:  87% (392/450)   
Receiving objects:  88% (396/450)   
Receiving objects:  89% (401/450)   
Receiving objects:  90% (405/450)   
Receiving objects:  91% (410/450)   
Receiving objects:  92% (414/450)   
Receiving objects:  93% (419/450)   
Receiving objects:  94% (423/450)   
Receiving objects:  95% (428/450)   
Receiving objects:  96% (432/450)   
Receiving objects:  97% (437/450)   
Receiving objects:  98% (441/450)   
Receiving objects:  99% (446/450)   
Receiving objects: 100% (450/450)   
Receiving objects: 100% (450/450), 76.44 KiB | 0 bytes/s, done.
Resolving deltas:   0% (0/205)   
Resolving deltas:   2% (6/205)   
Resolving deltas:   6% (13/205)   
Resolving deltas:   8% (17/205)   
Resolving deltas:   9% (19/205)   
Resolving deltas:  20% (41/205)   
Resolving deltas:  37% (77/205)   
Resolving deltas:  38% (79/205)   
Resolving deltas:  43% (90/205)   
Resolving deltas:  55% (113/205)   
Resolving deltas:  56% (115/205)   
Resolving deltas:  58% (120/205)   
Resolving deltas:  59% (122/205)   
Resolving deltas:  66% (136/205)   
Resolving deltas:  68% (140/205)   
Resolving deltas:  71% (147/205)   
Resolving deltas:  72% (149/205)   
Resolving deltas:  74% (152/205)   
Resolving deltas:  79% (162/205)   
Resolving deltas:  80% (165/205)   
Resolving deltas:  86% (178/205)   
Resolving deltas:  87% (179/205)   
Resolving deltas:  91% (187/205)   
Resolving deltas: 100% (205/205)   
Resolving deltas: 100% (205/205), done.
Checking connectivity... done.
�[31m�[1mRegistry update failed (http_error)�[0m

05:13:43.534 [error] Unable to load crypto library. Failed with error:
":load_failed, Failed to load NIF library /app/.platform_tools/erlang/lib/crypto-3.3/priv/lib/crypto: 'libcrypto.so.0.9.8: cannot open shared object file: No such file or directory'"
OpenSSL might not be installed on this system.


05:13:43.560 [error] The on_load function for module crypto returned {:error,
 {:load_failed,
  'Failed to load NIF library /app/.platform_tools/erlang/lib/crypto-3.3/priv/lib/crypto: \'libcrypto.so.0.9.8: cannot open shared object file: No such file or directory\''}}

{:failed_connect, [{:to_address, {'s3.amazonaws.com', 443}}, {:inet, [:inet], {:eoptions, {:undef, [{:crypto, :supports, [], []}, {:tls_record, :supported_protocol_versions, 1, [file: 'tls_record.erl', line: 310]}, {:tls_record, :supported_protocol_versions, 0, [file: 'tls_record.erl', line: 245]}, {:ssl, :handle_options, 2, [file: 'ssl.erl', line: 620]}, {:ssl, :connect, 4, [file: 'ssl.erl', line: 124]}, {:http_transport, :connect, 4, [file: 'http_transport.erl', line: 134]}, {:httpc_handler, :connect, 4, [file: 'httpc_handler.erl', line: 889]}, {:httpc_handler, :connect_and_send_first_request, 3, [file: 'httpc_handler.erl', line: 903]}]}}}]}
�[31m�[1m** (Mix) Failed to fetch registry�[0m

 !     Push rejected, failed to compile elixir app

Unable to change config on heroku deployment

Hi,

I've deployed on heruko, but am unable to change the configuration.

I've tried 2 things,
Changing the app_key and app_secret in /config/poxa.conf
and
Also tried by adding a my_config.exs (in the root?) and the --config my_config.exs to the command Procfile.

None of the above work, it only works when I change the defaults fallbacks in /config/config.exs

Question: Client ping causing error in poxa?

Hi,

Poxa seems to be working well for me except for when the keep-alive ping is being sent from two different .NET based clients (PusherClient and JDI.Pusher) that I'm using. Here is a sample error message being kicked out by poxa:

15:43:46.601 [error] Ranch listener :http had connection process started with :cowboy_protocol:start_link/4 at #PID<0.351.0> exit with reason: {[reason: :function_clause, mfa: {Poxa.WebsocketHandler, :websocket_handle, 3}, stacktrace: [{Poxa.WebsocketHandler, :websocket_handle, [{:ping, "2015-07-03 3:43:46 PM"}, {:http_req, #Port<0.6037>, :ranch_tcp, :keepalive, #PID<0.351.0>, "GET", :"HTTP/1.1", {{127, 0, 0, 1}, 56437}, "localhost", :undefined, 8081, "/app/7D45B688CA9841BE898E", :undefined, "protocol=5&client=pusher-dotnet-client&version=0.0.1", [{"protocol", "5"}, {"client", "pusher-dotnet-client"}, {"version", "0.0.1"}], [app_key: "7D45B688CA9841BE898E"], [{"upgrade", "WebSocket"}, {"connection", "Upgrade"},
{"sec-websocket-version", "13"}, {"sec-websocket-key", "ZjJkNDI2YWYtMWU1MS00OA=="}, {"host", "localhost:8081"}, {"origin", "ws://localhost:8081"}], [{"upgrade", ["websocket"]}, {"connection", ["upgrade"]}], :undefined, [websocket_version:13, websocket_compress: false], :waiting, "", :undefined, false, :done, [], "", :undefined}, %Poxa.WebsocketHandler.State{socket_id: "2705428123.152006606", time: 1435959766}], [file: 'lib/poxa/websocket_handler.ex', line: 72]}, {:cowboy_websocket, :handler_call, 7, [file: 'src/cowboy_websocket.erl', line: 588]}, {:cowboy_protocol, :execute, 4, [file: 'src/cowboy_protocol.erl', line: 435]}], msg: {:ping, "2015-07-03 3:43:46 PM"}, req: [socket: #Port<0.6037>, transport: :ranch_tcp, connection: :keepalive, pid: #PID<0.351.0>, method: "GET", version: :"HTTP/1.1", peer: {{127, 0, 0, 1}, 56437}, host: "localhost", host_info: :undefined, port: 8081, path: "/app/7D45B688CA9841BE898E", path_info: :undefined, qs: "protocol=5&client=pusher-dotnet-client&version=0.0.1", qs_vals: [{"protocol", "5"}, {"client", "pusher-dotnet-client"}, {"version", "0.0.1"}], bindings: [app_key: "7D45B688CA9841BE898E"], headers: [{"upgrade", "WebSocket"}, {"connection", "Upgrade"}, {"sec-websocket-version", "13"}, {"sec-websocket-key", "ZjJkNDI2YWYtMWU1MS00OA=="}, {"host", "localhost:8081"}, {"
origin", "ws://localhost:8081"}], p_headers: [{"upgrade", ["websocket"]}, {"connection", ["upgrade"]}], cookies: :undefined, meta: [websocket_version: 13, websocket_compress: false], body_state: :waiting, buffer: "", multipart: :undefined, resp_compress: false, resp_state: :done, resp_headers: [], resp_body: "", onresponse: :undefined], state: %Poxa.WebsocketHandler.State{socket_id: "2705428123.152006606", time: 1435959766}], [{:cowboy_protocol, :execute, 4, [file: 'src/cowbo
y_protocol.erl', line: 435]}]}

I'm not sure whether the issue is on the client or server side or even really how to interpret what is going on here. I've looked around for support somewhere else to no avail. Is there anything obvious in this apparent stacktrace as to what the problem is?

Thanks,

Doug

Docker run dont goes to background

Hi!
If you run docker with

docker run --rm -p 8080:8080 -v $PWD/mypoxa.conf:/app/releases/0.4.2/poxa.conf edgurgel/poxa:0.4.2

you will have poxa running on foreground. If i understand right, it should go in background and return from docker run command. What are the best practices for run poxa in docker?

cowboy_protocol error

I just checked my logs, Poxa is running and working but I see this often, what is it telling me? 😄

02:14:33.906 [error] Error in process #PID<0.1599.1> on node :"[email protected]" with exit value:
{:function_clause,
 [{:cowboy_protocol, :parse_method,
   ["",
    {:state, #Port<0.35795>, :ranch_tcp, [:cowboy_router, :cowboy_handler],
     false,
     [listener: :http,
      dispatch: [{:_, [],
        [{["ping"], [], Poxa.PingHandler, []},
         {["console"], [], Poxa.Console.WSHandler, []},
         {[], [], :cowboy_static, {:priv_file, :poxa, 'index.html'}},
         {["static", :...], [], :cowboy_static, {:priv_dir, :poxa, 'static'}},
         {["apps", :app_id, "events"], [], Poxa.EventHandler, []},
         {["apps", :app_id, "channels"], [], Poxa.ChannelsHandler, []},
         {["apps", :app_id, "channels", :channel_name], [],
          Poxa.ChannelsHandler, []},
         {["apps", :app_id, "channels", :channel_name, "users"], [],
          Poxa.UsersHandler, []},
         {["app", :app_key], [], Poxa.WebsocketHandler, []}]}]], :undefined,
     :undefined, 5, 1, 100, 4096, 64, 4096, 100, 5000, 1448936078905},
    <<1, 100, 101, 102, 97, 117, 108, 116, 10>>],
   [file: 'src/cowboy_protocol.erl', line: 168]}]}


02:14:33.907 [error] Ranch listener :http had connection process started with :cowboy_protocol:start_link/4 at #PID<0.1599.
1> exit with reason: {:function_clause, [{:cowboy_protocol, :parse_method, ["", {:state, #Port<0.35795>, :ranch_tcp, [:cowb
oy_router, :cowboy_handler], false, [listener: :http, dispatch: [{:_, [], [{["ping"], [], Poxa.PingHandler, []}, {["console
"], [], Poxa.Console.WSHandler, []}, {[], [], :cowboy_static, {:priv_file, :poxa, 'index.html'}}, {["static", :...], [], :c
owboy_static, {:priv_dir, :poxa, 'static'}}, {["apps", :app_id, "events"], [], Poxa.EventHandler, []}, {["apps", :app_id, "
channels"], [], Poxa.ChannelsHandler, []}, {["apps", :app_id, "channels", :channel_name], [], Poxa.ChannelsHandler, []}, {[
"apps", :app_id, "channels", :channel_name, "users"], [], Poxa.UsersHandler, []}, {["app", :app_key], [], Poxa.WebsocketHan
dler, []}]}]], :undefined, :undefined, 5, 1, 100, 4096, 64, 4096, 100, 5000, 1448936078905}, <<1, 100, 101, 102, 97, 117, 1
08, 116, 10>>], [file: 'src/cowboy_protocol.erl', line: 168]}]}

History support

People asked pusher to make history. Its bad for user experience when you change page and loose message. Its cool to have "custom made" history for pusher. Any ideas?

Error when running tests

I get this when I try running MIX_ENV=test mix test:

lowks@lowkster:~/src/elixir/poxa> MIX_ENV=test mix test
* Compiling hackney
==> hackney (compile)
src/hackney_socks5.erl:12: can't find include lib "kernel/src/inet_dns.hrl"
ERROR: compile failed while processing /home/lowks/src/elixir/poxa/deps/hackney: rebar_abort
** (Mix) Could not compile dependency hackney, /home/lowks/.mix/rebar command failed. If you want to recompile this dependency, please run: mix deps.compile hackney

ignore posted in the wrong project.

went through the following steps from the site http://elixir-lang.org/getting_started/1.html

$ git clone https://github.com/elixir-lang/elixir.git
$ cd elixir
$ make clean test

and i get the following error when i run the cmd make clean test

cd lib/elixir && ../../rebar clean
==> elixir (clean)
rm -rf ebin
rm -rf lib//ebin
rm -rf lib/elixir/test/ebin
rm -rf lib/
/tmp
rm -rf lib/mix/test/fixtures/git_repo
rm -rf lib/mix/test/fixtures/deps_on_git_repo
rm -rf lib/mix/test/fixtures/git_rebar
rm -rf lib/elixir/src/elixir.app.src
==> elixir (compile)
unexpected error compiling src/elixir_parser.yrl
{'EXIT',{undef,[{yecc,file,
["src/elixir_parser.yrl",
[{parserfile,"src/elixir_parser.erl"},
{report,true},
{verbose,false},
{return,true}]],
[]},
{rebar_erlc_compiler,compile_xrl_yrl,5,
[{file,"src/rebar_erlc_compiler.erl"},
{line,429}]},
{rebar_base_compiler,compile,3,
[{file,"src/rebar_base_compiler.erl"},
{line,121}]},
{rebar_base_compiler,compile_worker,3,
[{file,"src/rebar_base_compiler.erl"},
{line,194}]}]}}
ERROR: compile failed while processing /home/xxxx/elixir/lib/elixir: rebar_abort
make: *** [erlang] Error 1

Warning about latin1 encoding while using UTF-8

When running poxa from my upstart script I get this warning:

warning: the VM is running with native name encoding of latin1 which may cause Elixir to malfunction as it expects utf8. Please ensure your locale is set to UTF-8 (which can be verified by running "locale" in your shell)

Running locale I get this:

LANG=en_US.utf-8
LC_CTYPE="en_US.utf-8"
LC_NUMERIC="en_US.utf-8"
LC_TIME="en_US.utf-8"
LC_COLLATE="en_US.utf-8"
LC_MONETARY="en_US.utf-8"
LC_MESSAGES="en_US.utf-8"
LC_PAPER="en_US.utf-8"
LC_NAME="en_US.utf-8"
LC_ADDRESS="en_US.utf-8"
LC_TELEPHONE="en_US.utf-8"
LC_MEASUREMENT="en_US.utf-8"
LC_IDENTIFICATION="en_US.utf-8"
LC_ALL=

Is there anywhere else I can configure it? Am I doing something wrong?

Got strange 4001 error

Today I tested Pusher 3.0 JS client with Poxa on Chrome on Mac and got strange error:
pusher_error
It uses app_id, app_key and app_secret eq to '1'.
My colleague also had same problem on Chrome on Mac. It works in Safari. It works in Chrome on Windows.
I tried to disable encryption in js client, but ring no bells. I run pusher in docker, that is then proxied over nginx to the world.
I switched to official pusher server and problem has gone.
I think problem can be with missing responses to pusher servers.
One of them is routes like "/timeline*" for stats.
Also, as I remember, pusher sometimes send server list to connect.
I still investigating the problem.

@edgurgel Did You ever had this problem?

Docker pull edgurgel/poxa dont work

Hi!
If you try to use regular docker syntax to pull image you get error

> docker pull edgurgel/poxa
Using default tag: latest
Pulling repository docker.io/edgurgel/poxa
Tag latest not found in repository docker.io/edgurgel/poxa

Could you please add tag latest to 0.4.2 image?

Signaturex compile failure on poxa 0.5.0

Our systems use poxa 0.5.0 and just this morning the poxa 0.5.0 install isn't working.

$ ./install_poxa.sh

=INFO REPORT==== 22-Jun-2016::14:32:02 ===
    application: logger
    exited: {{shutdown,{failed_to_start_child,'Elixir.GenEvent',undef}},
             {'Elixir.Logger.App',start,[normal,[]]}}
    type: temporary
2016-06-22 14:32:03 URL:https://s3.amazonaws.com/s3.hex.pm/installs/1.0.0/hex.ez [328934/328934] -> "/home/vagrant/.mix/archives/hex.ez" [1]
* creating /home/vagrant/.mix/archives/hex.ez

=INFO REPORT==== 22-Jun-2016::14:32:04 ===
    application: logger
    exited: {{shutdown,{failed_to_start_child,'Elixir.GenEvent',undef}},
             {'Elixir.Logger.App',start,[normal,[]]}}
    type: temporary
* creating /home/vagrant/.mix/rebar

=INFO REPORT==== 22-Jun-2016::14:32:04 ===
    application: logger
    exited: {{shutdown,{failed_to_start_child,'Elixir.GenEvent',undef}},
             {'Elixir.Logger.App',start,[normal,[]]}}
    type: temporary
inch_ex is missing its version requirement, use ">= 0.0.0" if it should match any version
Running dependency resolution
All dependencies up to date

=INFO REPORT==== 22-Jun-2016::14:32:05 ===
    application: logger
    exited: {{shutdown,{failed_to_start_child,'Elixir.GenEvent',undef}},
             {'Elixir.Logger.App',start,[normal,[]]}}
    type: temporary
==> signaturex
Compiled lib/signaturex/crypto_helper.ex

== Compilation error on file lib/signaturex.ex ==
** (CompileError) lib/signaturex.ex: internal error in lint_module;
crash reason: badarg

  in function  erl_anno:anno_info/1
     called as erl_anno:anno_info(-1)
  in call from erl_lint:loc/2 (erl_lint.erl, line 640)
  in call from erl_lint:icrt_export/4 (erl_lint.erl, line 3094)
  in call from erl_lint:icrt_clauses/4 (erl_lint.erl, line 3076)
  in call from erl_lint:expr/3 (erl_lint.erl, line 2168)
  in call from erl_lint:bin_element/4 (erl_lint.erl, line 1756)
  in call from lists:foldl/3 (lists.erl, line 1263)
  in call from erl_lint:expr_bin/4 (erl_lint.erl, line 1751)
    (stdlib) lists.erl:1338: :lists.foreach/2
    lib/signaturex.ex:4: (module)

could not compile dependency signaturex, mix compile failed. You can recompile this dependency with `mix deps.compile signaturex` or update it with `mix deps.update signaturex`

=INFO REPORT==== 22-Jun-2016::14:32:06 ===
    application: logger
    exited: {{shutdown,{failed_to_start_child,'Elixir.GenEvent',undef}},
             {'Elixir.Logger.App',start,[normal,[]]}}
    type: temporary
==> signaturex
Compiled lib/signaturex/crypto_helper.ex

== Compilation error on file lib/signaturex.ex ==
** (CompileError) lib/signaturex.ex: internal error in lint_module;
crash reason: badarg

  in function  erl_anno:anno_info/1
     called as erl_anno:anno_info(-1)
  in call from erl_lint:loc/2 (erl_lint.erl, line 640)
  in call from erl_lint:icrt_export/4 (erl_lint.erl, line 3094)
  in call from erl_lint:icrt_clauses/4 (erl_lint.erl, line 3076)
  in call from erl_lint:expr/3 (erl_lint.erl, line 2168)
  in call from erl_lint:bin_element/4 (erl_lint.erl, line 1756)
  in call from lists:foldl/3 (lists.erl, line 1263)
  in call from erl_lint:expr_bin/4 (erl_lint.erl, line 1751)
    (stdlib) lists.erl:1338: :lists.foreach/2
    lib/signaturex.ex:4: (module)

could not compile dependency signaturex, mix compile failed. You can recompile this dependency with `mix deps.compile signaturex` or update it with `mix deps.update signaturex`

It appears to be failing when trying to compile signaturex from the mix compile command. I'm trying to debug this for now, but if you have any advice it would be helpful. I'm not super familiar with the Elixir build system.

Why public events are not published?

I'm trying to use public channels and I can't find a way to broadcast the messages. I see that messages for public channels are not being published (code).

I have to use private or presence channels? The .NET client library has a complicated authentication mechanism for this channels, I'm trying to avoid it.

Delay member_removed and channel_vacated webhooks

There is a delay of up to three seconds between a client disconnecting and channel_vacated or member_removed WebHooks being sent. If the client reconnects within this delay, no WebHooks will be sent.

I was thinking on something like the handler saving for 3 seconds and if nothing comes to invalidate it (for example a member_added right after a member_removed on the same channel and same user_id)

The state of the handler should be used to check this.

Network error connecting to pusher (Errno::ECONNREFUSED)

I set it up poxa is running successfully on port 8080. Here are logs for same


11:36:46.304 [info]  Subscribing to channel live_chat_1c9994304e093170958293b1378481a3_proj_id_1

11:36:46.304 [info]  Registering #PID<0.515.0> to channel live_chat_1c9994304e093170958293b1378481a3_proj_id_1

11:36:46.473 [info]  Registering #PID<0.515.0> to channel presence-chat-a49c5686fca263cfeb61540daa49608b

11:36:46.474 [info]  Subscribing to channel private-typingIndicator1c9994304e093170958293b1378481a3_proj_id_1development

11:36:46.474 [info]  Registering #PID<0.515.0> to channel private-typingIndicator1c9994304e093170958293b1378481a3_proj_id_1development

But it's not transmitting messages to and fro. either channels are not binding properly or something. Pushe is giving me this error. Network error connecting to pusher (Errno::ECONNREFUSED)

Do not log the app key/secret

Not sure if this falls under the umbrella of issue #38 or not, but I thought it deserves its own issue. This is obviously a security issue and should not be logged

Define config/config.exs

Also change README to use config.exs instead of Erlang config files. Also specify link to exrm documentation on how to configure releases properly.

Crypto.app error when using 'mix deps.get'

Poxa: v0.4.3
Elixir: 1.0.0
Erlang: 17.0

Running mix deps.get

{"init terminating in do_boot",{{badmatch,{error,{crypto,{"no such file or directory","crypto.app"}}}},[{elixir,start_cli,0,[{file,"src/elixir.erl"},{line,56}]},{init,start_it,1,[]},{init,start_em,1,[]}]}}

Is that an Elixir error?

Invalid signature: Expected HMAC SHA256 hex digest of ...

Hey,

we started Poxa via Docker with its default config. When I try to subscribe to a private channel, I get the following error:

Pusher : Error : {"type":"WebSocketError","error":{"type":"PusherError","data":{"code":null,"message":"Invalid signature: Expected HMAC SHA256 hex digest of 151004717.3505838415:private-test, but got {\"auth\":\"app_key:ceb4d48b4403ee6bc48eef122af7c9c847fc1a6abbc26996fb10ccd1ad97dc7a\"}"}}}

I am not sure what is causing the problem. I am using version v2.4.1 of the pusher php server lib and 3.1 of the javascript lib.

My code to return the auth key is the following:

$pusher = new \Pusher('app_key', 'secret', 'app_id', [], 'our host', 8080);
        $key = $pusher->socket_auth($request->get('channel_name'), $request->get('socket_id'));
        return new JsonResponse(['auth' => $key], 200);

Everything looks fine.

Batch webhooks

The handler should be just a collector of requests to be sent and another process should keep watching the messages to be sent and batch them.

I was thinking on something like a simple ets table. This would even make it easier to deal with the delay for some events (#67)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.