CodeIgniter Forums
synchronize different sessions when events happened. - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: synchronize different sessions when events happened. (/showthread.php?tid=45738)



synchronize different sessions when events happened. - El Forum - 10-04-2011

[eluser]Trankh1[/eluser]
Hello,

I'm writing a social networking application and I want to synchronize different sessions.

My context is following:

userA is logged and has an array of his contacts in session.
userB is logged and has an array of his contacts in session.

userA adds userB as a contact.
So, Contact table (DB) sees a new record
And userA has an update of his array of contacts (easy because the event happens on userA navigation side)

My need is following:

I want now to synchronize automatically userB's session so that his array of contacts is refreshed
without doing a sql query to check the contacts table (db). I want that in order to avoid making too many sql queries to check that.

Do you have any suggestions?

I'm using CodeIgniter last version and the session is managed with database.

Code:
$config['sess_cookie_name']             = 'ci_session';
$config['sess_expiration']              = 0;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie']  = TRUE;  
$config['sess_use_database'] = TRUE;
$config['sess_table_name']              = 'ci_sessions';
$config['sess_match_ip']                = FALSE;
$config['sess_match_useragent'] = FALSE;
$config['sess_time_to_update']  = 300;

Thanks a lot