hoaproject / Router

The Hoa\Router library.
https://hoa-project.net/
28 stars 11 forks source link

New context: Socket/WebSocket. #14

Open Metalaka opened 10 years ago

Metalaka commented 10 years ago

It could be cool to be able to use Hoa\router in a WebSocket context like in Http context.

Some behaviour differ like Router::getURI() and the way to return data, so there is some of work here.

thoughts?

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/4005876-new-context-socket-websocket?utm_campaign=plugin&utm_content=tracker%2F459946&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F459946&utm_medium=issues&utm_source=github).
Hywan commented 10 years ago

Hello :-),

Would it help to implement sub-protocols in WebSocket (https://github.com/hoaproject/Websocket/blob/10747c1e5fe1eadff8f9c53ef3614cc911a401cf/Protocol/Rfc6455.php#L117-L118)? If yes, it would be an elegant way to do that. I like the idea.

Metalaka commented 10 years ago

I thought to some thing like this when I opened the issue.

But, can you explain your thought ? I don't understand what you would like to do.

Hywan commented 10 years ago

WebSocket defines the availibity of embedding protocols inside messages (I call them subprotocols). We can see them as extensions. An example: http://wamp.ws/.

A protocol is a just a router + a dispatcher + nice controllers. In the case of WebSocket and subprotocols, we could have a generic router (as you proposed) and one router per protocol that just fires events (or something like that). I am thinking since several months of an elegant way to implement subprotocols but using the router is a nice idea.

Thoughts?

Metalaka commented 10 years ago

Ok, it's clearer. I like the idea. I wait with impatience for the first drafts.

Hywan commented 10 years ago

I don't know if it is even possible. Do you want to try?

Metalaka commented 10 years ago

I've no idea of how to do that, so I prefer wait :)

Hywan commented 10 years ago

Ok. It will require a lot of time so I am not sure to do that right now.