Laravel session data over websocket - session

Recently I have being playing with a project I found on github called Laravel Websocket Poker (https://github.com/troymccormick/laravel-pkr/). I have it all running and working well. When you open the game page, you a presented with a dialog for your chosen username. I want to modify this, so that the session data of the current user is able to be used within the websockets.
So my question is, how can I associate the users laravel session info with their websocket connection?
Thank you!

Related

How to preserve flask session after deleting browser history, cache?

I´m developing an app that summarizes text, but i want that non-account user have limited entrances to the tool. Right now, i have accomplish this partially since these users only can use it 5 times a day, but i realized that deleting browser history restarts the session of the non-account user.
Can someone please guide me to the solution?
I´m basically using flask, javascript, ajax
I have done the limited entrances to the system for non-account users, but I´m trying to preserve this data (of how many entrances the user has with the tool) after the browser history and cache are deleted.
You can log anonymous user access using other more static factors like IP address and use that to block more than 5 requests.
Flask has a library to implement the stated functionality called Flask Limiter.
https://flask-limiter.readthedocs.io/en/stable

Is there any way in laravel 5.4 to track how many time spent by login user?

Hi All Master Laravel,
I need your help to get data timespent from login user in laravel, I'm using Sentinel for login and Laravel 5.4
If only one page, we can use TimeOut javascript, but what I need is log for user which spent all page in my website
Regards,
Sidik
As I know there is no built-in solution for your purpose.
But you can write your personal implementation based on data from user requests.
Also, you can use third party service for this purpose too, for example Google Analytics. Here is an example how to set up the user ID into your analytics code.

admin laravel Notification system

Hi guys am working on an back-end system(admin) in laravel. I would like to send notifications realtime to the admin whenever a user makes some changes from thier side. for instance if a user creates a new project, i would like for the admin to be notified when the user submits the project details to the database. Please help me with a model of the same. thanks
Your question is very broad and you don't specify a clear problem. However, for real time notifications I'd suggest you to look at the following libraries: Socket IO, Ratchet and Pusher.

Laravel + Unity3D = how to get the connected user?

I'm doing an API for a mobile application. The application is made with Unity3D (I'm not developping it) but the guy who makes it told me that the session is not stored in Unity because it doesn't suport cookies.
I tried with Laravel to stores "cookie" in a file, but that didn't solve the problem.
Actually, in Unity, here is what is happening :
- log the user // returns : "Ok, logged."
- check if connected // returns : "user not connected"
I tried to do Session::setId() but it didn't work. Why ? Because I think the user is not in the Session but in the "Auth::" class. I didn't find any way to load the user who was connected.
I'm searching for an ID to get the first time and pass it as parameter in the URL to set it in the PHP to retrieve the connected user.
Your help is welcomed.
Thank you.
IF Unity doesn't support cookies, then you shouldn't be using PHP or Laravel sessions.
The alternative is to pass SystemInfo.deviceUniqueIdentifier in every request (in a header or POST, or GET field) from app to API. And on your API server you should make a DB table to write down all info you need about particular device: unique_identifier => all_the_info_i_have_on_this_device.
This works even better than cookies, because because user is not able to delete cookies or clear session.

Cookie across different domains

I am working on building a learners website (http:localhost:8080.xyz.com).This is being built on glassfish server using gwt.I need to integrate forums(http:localhost:8888.abc.com)into this site .The forum is built using php and is on Apache Server.
Both the websites share the same MySQL database and this database has a table named session table which has information about the user id and corresponding session id.
Now i am trying to integrate the forum into my website using an Iframe.
My first question here is,once the user logins into my website will my website and the iframe have the same session id?
If they dont have the same session id what would be the best way to implement the functionality that when user logins into my system he is also automatically logged in into the forum?
Thanks
Easy Solution:
Send the user (via iframe or ajax or whatever) to a page on domain B, providing the session ID as a get parameter (http:localhost:8888.abc.com/sso.php?sessid=the_sess_id), then create the cookie on domain B.
More complicated solution:
Setup one of the two servers as a reverse proxy so both apps share the same domain and cookies.

Resources