rabbit-socks icon indicating copy to clipboard operation
rabbit-socks copied to clipboard

socket.io support

Open yrashk opened this issue 14 years ago • 6 comments

Hi,

Just wondering if it will make it easier to support socket.io if you'll be reusing socket.io-erlang (https://github.com/yrashk/socket.io-erlang). Not sure whether it's possible to do use it with rabbit-socks, just wanted to make sure you're aware of its existence and will be glad to help if necessary.

Anyway, thanks!

yrashk avatar Mar 18 '11 12:03 yrashk

Hi Yurii,

We are using mochiweb for a few other things, and we have a kind of multi-app hosting thing going on with it (see rabbitmq-mochiweb). How difficult do you think it would be to disentangle socket.io-erlang from misultin enough to make a mochiweb adapter for it?

To be honest I quite like the API style of socket.io-erlang, so it'd be great if we could use it.

Cheers, keep up the great work (erlzmq too)! Michael

squaremo avatar Apr 08 '11 14:04 squaremo

Yurii, don't know if you saw, I forked socketio-erlang and started adding mochiweb support. So far, nothing controversial.

However, I would like to add the path into the information that the event listener gets, so it can close the request or socket. In fact, I'd like to be able to "reject" the request or websocket connection if the path is not to my application's liking, and return e.g., a 404. The current API doesn't really allow for this.

This goes a bit further than socketio-node but not in an incompatible way; i.e,. it is still easy to have just the same behaviour as socket.io-node.

Thoughts?

squaremo avatar Jul 07 '11 16:07 squaremo

There was a change suggested by @skarab some time ago, and I think it will be a good idea to finally add it. The idea is to insert a generic behaviour before the gen_event and implement a default behaviour that will be that gen_event. This way you can supply any information any way you want. Thoughts?

yrashk avatar Jul 07 '11 16:07 yrashk

Not sure I understand the suggestion. Is there a patch or more discussion somewhere?

squaremo avatar Jul 11 '11 13:07 squaremo

There is no patch (yet) — it was just a discussion at the Factory. The idea is that right now all the events go directly to a gen_event event manager. @skarab's suggestion was to generalize this a bit — by implementing different behaviours (callbacks) on what to do with incoming clients/messages; and to preserve backwards compatibility, a default behaviour would be to push those events out through gen_event (to replicate today's behaviour). Any clearer now?

yrashk avatar Jul 11 '11 13:07 yrashk

Got it, yes. The event handler is quite tied in but it's plausible it can be factored out. I may give it a go ..

squaremo avatar Jul 11 '11 22:07 squaremo