cboden / Ratchet-examples

Tutorial code and cookbook classes for Ratchet
http://socketo.me
238 stars 73 forks source link

Ratchet authentication #6

Closed CMCDragonkai closed 10 years ago

CMCDragonkai commented 11 years ago

Hello, are you able to explain how authentication with sessions could work in Ratchet? I unfortunately cannot use the Symfony Sessions, so I'm thinking of having Router class be the end point, which allows an RPC call to do authentication, this would access the MySQL only on the connection open and authenticate once for the connection.

Furthermore what does $this->stubBot = new ConnectionStub; mean at https://github.com/cboden/Ratchet-examples/blob/master/src/Ratchet/Website/Bot.php#L21

I also need to be able to rout to two different uses of web sockets, one to do chat and another to do logging. So would have some sort of message to determine that, or would that be in the subscribed topic? The documentation is so sparse, how do I extract details from any of the parameters inside the interfaces...? They seem to be all hidden inside the source code.

Can you expand the tutorials to actually include using them for multiple purposes?

cboden commented 11 years ago

Hi @CMCDragonkai

My apologies for the documentation being sparse. I do my best, but it's a lot of work to support and maintain a project, its users, and its documentation on one's spare time. I have plans to improve the documentation, but it can't be right away, as I just don't have the time to dedicate to it.

If you would like to run more than one app in Ratchet, there are two options right now: Use the "unstable" http branch in Ratchet, which includes support for routing or use this example on how to do your own ad-hoc routing solution.

stubBot is a class that fakes a Connection. It is the "Lonely Bot" that speaks to you in the website demo.

I don't quite understand what you're asking for logging? Do you mean you want two endpoints for web browsers to access or you want to Ratchet/server events asynchronously?