Thruway PHPSESSION access

#1

Hey,

i used to build a small application with ratchet and implemented the SessionProvider found here: http://socketo.me/docs/sessions

After switching to AutobahnJS in the browser frontend, i realized ratchet does not implement WAMP v2, so i switched to crossbar.io and thruway and use it with my php backend.

In my application the user signs in and gets a simple PHP-Session with his information. I could not find out how to access this PHP-Session information. Is there any example or tutorial i can work through?

With ratchet i used the MemcachedSessionHandler as session storage on the web server and websocket server.

Thanks for the help and suggestions

0 Likes

#2

Hi!

Glad you’re using Crossbar.io.

Either I do not understand your question correctly, or this is really related to the Thruway/PHP side of things. We didn’t create Thruway, and are not using it ourselves either (all Python, C++ and JavaScript here).

So maybe this is something you want to ask the Thruway people?

Else let me know with more details about your problem.

Regards,

Alexander Gödde

···

From: cross...@googlegroups.com [mailto:cross...@googlegroups.com] On Behalf Of Eugen Kandakov
Sent: Donnerstag, 12. Februar 2015 00:34
To: cross...@googlegroups.com
Subject: Thruway PHPSESSION access

Hey,

i used to build a small application with ratchet and implemented the SessionProvider found here: http://socketo.me/docs/sessions

After switching to AutobahnJS in the browser frontend, i realized ratchet does not implement WAMP v2, so i switched to crossbar.io and thruway and use it with my php backend.

In my application the user signs in and gets a simple PHP-Session with his information. I could not find out how to access this PHP-Session information. Is there any example or tutorial i can work through?

With ratchet i used the MemcachedSessionHandler as session storage on the web server and websocket server.

Thanks for the help and suggestions


You received this message because you are subscribed to the Google Groups “Crossbar” group.
To unsubscribe from this group and stop receiving emails from it, send an email to crossbario+...@googlegroups.com.
To post to this group, send email to cross...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/crossbario/3e7aab9d-876f-4128-98ea-ca430a2c6544%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

0 Likes

#3

Eugen,

Wamp routers like Crossbar are not going to manage your PHP sessions for you. You might still be able to access your PHP sessions, but you’ll have to do it by writing a custom session handler.

Wamp routers will allow you to authenticate (probably you will use ticket authentication or CRA). After you authenticate, the wamp router will know your authid or have some token that can be mapped to your backend user. You’ll need to tell wamp to “disclose_caller” when you invoke RPC on your PHP backend and then using that wamp authid or wamp token, you can then find the session data for the user, load it in a PHP object and use it for your request.

You’ll want to be careful, however … because in PHP with Apache, the $_SESSION variable comes into existence when your page loads and is destroyed when the script ends. When you are using PHP with Thruway, your PHP application is running non-stop, so if you create a $_SESSION variable, it will not be auto-destroyed on the next function call. You’ll likely want to have “session” objects that load data in a non-global way (remember $_SESSION is considered a super-global). Something like $session_data = new Com/Example/Session( $wamp_auth_id) is what you’ll need to build.

– Dante

···

On Wednesday, February 11, 2015 at 5:34:17 PM UTC-6, Eugen Kandakov wrote:

Hey,

i used to build a small application with ratchet and implemented the SessionProvider found here: http://socketo.me/docs/sessions

After switching to AutobahnJS in the browser frontend, i realized ratchet does not implement WAMP v2, so i switched to crossbar.io and thruway and use it with my php backend.

In my application the user signs in and gets a simple PHP-Session with his information. I could not find out how to access this PHP-Session information. Is there any example or tutorial i can work through?

With ratchet i used the MemcachedSessionHandler as session storage on the web server and websocket server.

Thanks for the help and suggestions

0 Likes