note 125549 deleted from function.session-write-close by cmb
| From: | cmb@php.net | Date: | Sat, 28 Nov 2020 12:04:08 +0000 |
| Subject: | note 125549 deleted from function.session-write-close by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-215908@lists.php.net to get a copy of this message | ||
Note Submitter: Sbastien
----
Feedback :
I had a problem on a "modern" app using a JS front (Vue) and a PHP back querying a MySQL
DB. All data is retrieved asynchronously via webservices (JS fetch()).
Sessions are used to easily manage user authentication : just a session_start() in an included
script, some controls about user, and no more attention about session.
Multiple fetch() were executed sequentially by the browser with pending status :
ws.php?action=getSomething 3s 3s [===]
ws.php?action=getSomething2 2s 5s [==]
ws.php?action=getSomething3 4s 9s [====]
ws.php?action=getSomething4 2s 11s [==]
Where I hoped full async :
ws.php?action=getSomething 3s 3s [===]
ws.php?action=getSomething2 2s 2s [==]
ws.php?action=getSomething3 4s 4s [====]
ws.php?action=getSomething4 2s 2s [==]
Finally, I obtain this 2nd case full async by using session_write_close() in ws.php as soon as I
need no more to write to $_SESSION and before executing long SQL queries.