note 125549 added to function.session-write-close
| From: | Sbastien@php.net | Date: | Sat, 28 Nov 2020 11:55:11 +0000 |
| Subject: | note 125549 added to function.session-write-close | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-215907@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 45.112.84.4
Probable Submitter: 45.91.156.130 (proxied: 82.65.8.175)
----
Manual Page -- http://php.net/manual/en/function.session-write-close.php
Edit -- https://master.php.net/note/edit/125549
Del: integrated -- https://master.php.net/note/delete/125549/integrated
Del: useless -- https://master.php.net/note/delete/125549/useless
Del: bad code -- https://master.php.net/note/delete/125549/bad+code
Del: spam -- https://master.php.net/note/delete/125549/spam
Del: non-english -- https://master.php.net/note/delete/125549/non-english
Del: in docs -- https://master.php.net/note/delete/125549/in+docs
Del: other reasons-- https://master.php.net/note/delete/125549
Reject -- https://master.php.net/note/reject/125549
Search -- https://master.php.net/manage/user-notes.php