Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use two event handlers for two different ports from the same socketio application #71

Open
pauloros opened this issue Mar 7, 2012 · 3 comments

Comments

@pauloros
Copy link

pauloros commented Mar 7, 2012

I have a case where I'm expecting two classes of clients to connect to the same socketio application and they would each have their own different messages.

I'm trying to implement this using two different default_http_handlers but socketio_listener:start is giving me the same PID even if I specify different ports in different calls. Subsequently the socketio_listener:event_manager is obviously the same, so if I can't attach different handlers to the two different ports.

From the console:

application:start (misultin).
application:start (socketio).

{ok, Pid1} = socketio_listener:start([{http_port, 8485}, {default_http_handler,h1}]).
{ok, Pid2} = socketio_listener:start([{http_port, 8486}, {default_http_handler,h2}]).

Pid1 == Pid2.
true

Is there a workaround or a better way to achieve this?

@ferd
Copy link
Collaborator

ferd commented Mar 8, 2012

Hey there, could you please try my branch at https://github.com/ferd/socket.io-erlang (commit is ferd@a7a1a7c) to see if it works for you?

If it does and you can tell me it's stable enough, I might merge it here.

@pauloros
Copy link
Author

pauloros commented Mar 9, 2012

Hi, I gave it a quick spin and it seems to work as advertised. I'll split my code in two different handlers to see how it holds the road and will report back.

Thanks for the quick fix!

Paul

@pauloros
Copy link
Author

pauloros commented Mar 9, 2012

Checking back to report that things appear stable for my own use case, it's been running for a while with the two event managers and everything seems quite fine. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants