{"id":453883,"date":"2025-03-31T21:03:15","date_gmt":"2025-03-31T21:03:15","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=453883"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=453883","title":{"rendered":"<span>\u041f\u0440\u0438\u043c\u0435\u0440 HTTP-\u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043d\u0430 PHP \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0444\u0430\u0439\u0431\u0435\u0440\u043e\u0432. \u0423\u043b\u0443\u0447\u0448\u0435\u043d\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 <a href=\"https:\/\/habr.com\/ru\/articles\/866254\/\" rel=\"noopener noreferrer nofollow\">\u041f\u0440\u0438\u043c\u0435\u0440 HTTP-\u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043d\u0430 PHP \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0444\u0430\u0439\u0431\u0435\u0440\u043e\u0432 \/ \u0425\u0430\u0431\u0440<\/a>  \u043a\u0440\u0430\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u044b\u043c \u043a\u0430\u043c\u043d\u0435\u043c \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 HTTP-\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <a href=\"https:\/\/www.php.net\/manual\/ru\/function.socket-select.php\" rel=\"noopener noreferrer nofollow\">socket_select()<\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 &#8212; \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043b\u044e\u0431\u043e\u0439 \u0438\u0437 \u0442\u0440\u0451\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 1024. \u0414\u0430\u043d\u043d\u044b\u0439 \u043b\u0438\u043c\u0438\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043e\u0439 FD_SETSIZE, \u0434\u043b\u044f \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u043b\u0438\u043c\u0438\u0442\u044b \u0438 \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440 PHP, \u0447\u0442\u043e \u043d\u0435\u0446\u0435\u043b\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u043e \u0438 \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b. \u041a \u0442\u043e\u043c\u0443 \u0436\u0435, \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <a href=\"https:\/\/manpages.org\/select\/2\" rel=\"noopener noreferrer nofollow\">select()<\/a>, \u043e\u0431\u0451\u0440\u0442\u043a\u043e\u0439 \u043d\u0430\u0434 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f socket_select(), \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0435\u0434\u0430\u0435\u0442 \u043f\u0440\u0438 \u043e\u0449\u0443\u0442\u0438\u043c\u043e\u043c \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b FD_SETSIZE. \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0443, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0443\u044e \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043e\u0442 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f. <\/p>\n<p>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 man-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0438 select, \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0430\u044e\u0449\u0438\u0439 \u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0435 \u0441 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u0430\u043c\u0438:<\/p>\n<pre><code>WARNING: select() can monitor only file descriptors numbers that        are less than FD_SETSIZE (1024)\u2014an unreasonably low limit for many        modern applications\u2014and this limitation will not change.  All        modern applications should instead use poll(2) or epoll(7), which        do not suffer this limitation.<\/code><\/pre>\n<p>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 Linux \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0430 Unix \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0443\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c, \u043f\u0440\u0438\u0441\u0443\u0449\u0438\u0445 \u0432\u044b\u0437\u043e\u0432\u0443 select(). \u0412 Linux \u0441\u0430\u043c\u043e\u0439 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0438 \u043b\u0438\u0448\u0451\u043d\u043d\u043e\u0439 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432 select() \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043e\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u044b\u0437\u043e\u0432 <a href=\"https:\/\/manpages.org\/epoll\/7\" rel=\"noopener noreferrer nofollow\">epoll()<\/a>. \u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0440\u0438\u0432\u044f\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u043a Linux \u0438 \u0432 \u0446\u0435\u043b\u044f\u0445 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0441\u0442\u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u0431\u044b\u043b\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <a href=\"https:\/\/libevent.org\/\" rel=\"noopener noreferrer nofollow\">libevent<\/a> \u0438 \u0435\u0439 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 (libev, libuv), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0432\u044b\u0437\u043e\u0432\u044b select, poll, epoll \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0432 \u0441\u0440\u0435\u0434\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u0412\u044b\u0431\u043e\u0440 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0441\u043e\u043a\u0435\u0442\u043e\u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0442\u0430\u043a\u0438\u043c\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u043c\u0438 \u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u043a\u043e\u0434\u0430. <\/p>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 libevent \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d\u0430 \u0431\u044b\u043b\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u0432 PHP \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f <a href=\"https:\/\/www.php.net\/manual\/ru\/book.event.php\" rel=\"noopener noreferrer nofollow\">event<\/a>. \u041e\u0434\u043d\u0430\u043a\u043e, API \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u044b\u0437\u043e\u0432\u0430 select(), \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0439 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f HTTP-\u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u043e\u0431\u043d\u044b\u043c \u0438 \u043d\u0430\u0434\u0451\u0436\u043d\u044b\u043c, \u043d\u043e \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0441\u043d\u0438\u0437\u0438\u0442\u044c \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c, \u0442.\u043a. \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043d\u0430 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u043e\u0432 \u0441\u043e\u043a\u0435\u0442\u043e\u0432 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 HTTP-\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439, \u043d\u043e \u0438 \u0441\u043e\u043a\u0435\u0442\u043e\u0432 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u0421\u0423\u0411\u0414 \u0438\u043b\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u043e\u0447\u0435\u0440\u0435\u0434\u0435\u0439. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u0432 PHP \u0442\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 <a href=\"https:\/\/www.php.net\/manual\/ru\/book.ev.php\" rel=\"noopener noreferrer nofollow\">ev<\/a>, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043a \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 <a href=\"https:\/\/github.com\/enki\/libev?tab=readme-ov-file\" rel=\"noopener noreferrer nofollow\">libev<\/a>, \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0434\u043b\u044f libevent. \u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0443\u0434\u043e\u0431\u043d\u043e\u0439 \u0437\u0430\u043c\u0435\u043d\u044b \u0434\u043b\u044f \u0432\u044b\u0437\u043e\u0432\u0430 socket_select(), \u0431\u0435\u0437 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0432 \u043a\u043e\u0434\u0435. \u0412\u0435\u0442\u043a\u0430 <a href=\"https:\/\/gitflic.ru\/project\/cleancodemonkey\/fabio?branch=event\" rel=\"noopener noreferrer nofollow\">event<\/a> \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u0441\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 socket_select() \u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f ev.<\/p>\n<h2>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u044b \u0432 \u043a\u043e\u0434\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430, \u0434\u043b\u044f \u0437\u0430\u043c\u0435\u043d\u044b \u0432\u044b\u0437\u043e\u0432\u0430 socket_select() \u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f ev<\/h2>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0431\u044b\u043b\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u044b \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 <a href=\"https:\/\/gitflic.ru\/project\/cleancodemonkey\/fabio\/blob?file=src%2FApp.php&amp;branch=event\" rel=\"noopener noreferrer nofollow\">CleanCodeMonkey\\Fabio\\App<\/a>. \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0446\u0438\u043a\u043b \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0442\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u043a\u043b\u044e\u0447\u0451\u043d \u0432 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0435 <a href=\"https:\/\/www.php.net\/manual\/ru\/ev.run.php\" rel=\"noopener noreferrer nofollow\">Ev::run()<\/a> \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"php\">public function run(): void {     App::debug(\"HTTP server has been started. Waiting for connections...\");     $supportedBackendNames = [];     $supportedBackends = Ev::supportedBackends();     if ($supportedBackends &amp; Ev::BACKEND_SELECT) {         $supportedBackendNames[Ev::BACKEND_SELECT] = 'select';     }     if ($supportedBackends &amp; Ev::BACKEND_POLL) {         $supportedBackendNames[Ev::BACKEND_POLL] = 'poll';     }     if ($supportedBackends &amp; Ev::BACKEND_EPOLL) {         $supportedBackendNames[Ev::BACKEND_EPOLL] = 'epoll';     }     if ($supportedBackends &amp; Ev::BACKEND_KQUEUE) {         $supportedBackendNames[Ev::BACKEND_KQUEUE] = 'kqueue';     }     if ($supportedBackends &amp; Ev::BACKEND_DEVPOLL) {         $supportedBackendNames[Ev::BACKEND_DEVPOLL] = 'devpoll';     }     if ($supportedBackends &amp; Ev::BACKEND_PORT) {         $supportedBackendNames[Ev::BACKEND_PORT] = 'port';     }     App::debug('Supported backends: %s, selected backend: %s', implode(', ', $supportedBackendNames), $supportedBackendNames[Ev::backend()] ?? 'unknown');     Ev::run(); }<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0435\u0434 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043e\u043c \u043a \u0446\u0438\u043a\u043b\u0443 \u0437\u0434\u0435\u0441\u044c \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0436\u0443\u0440\u043d\u0430\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u0431\u044d\u043a\u0435\u043d\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 libev (\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435\u043c ev). <\/p>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0446\u0438\u043a\u043b \u0432 \u0432\u044b\u0437\u043e\u0432\u0435 Ev::run() \u043d\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0441\u044f \u043f\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u0441\u043e\u043a\u0435\u0442\u043e\u0432, \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 App \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043d\u043e\u0432\u044b\u0445 HTTP-\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u0441\u043e\u043a\u0435\u0442\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430:<\/p>\n<pre><code class=\"php\">private function __construct(FiberedHandlerFactory $factory) {     $this-&gt;handlerCollection = new FiberedHandlerCollection($this);     $this-&gt;factory = $factory;     pcntl_async_signals(true);     pcntl_signal(SIGINT, [$this, 'interrupt']);     $serverSocket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);     if ($serverSocket === false) {         exit('Error creating server socket.');     }     if (!socket_set_nonblock($serverSocket)) {         exit('Error switching socket to the nonblocking mode.');     }     if (!socket_bind($serverSocket, getenv('HTTP_BIND_HOST'), (int)getenv('HTTP_BIND_PORT'))) {         exit('Error binding socket.');     }     if (!socket_listen($serverSocket, SOMAXCONN)) {         exit('Error switching socket to the listening mode.');     }     $this-&gt;handlerCollection-&gt;push($this-&gt;factory-&gt;createServerHandler($serverSocket, $this-&gt;handlerCollection)); }<\/code><\/pre>\n<p>\u041d\u0430 20 \u0441\u0442\u0440\u043e\u043a\u0435 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0430 \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u0432 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0443 \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043f\u043e \u0441\u043e\u043a\u0435\u0442\u0443:<\/p>\n<pre><code class=\"php\">public function push(FiberedHandler $handler): void {     $this-&gt;handlers[$handler-&gt;getId()] = $handler;     $this-&gt;app-&gt;subscribeHandler($handler); }<\/code><\/pre>\n<p>\u0412 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 subscribeHandler() \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0441\u043b\u0443\u0448\u0430\u0442\u0435\u043b\u0435\u0439 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0441\u043e\u043a\u0435\u0442\u043e\u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043b\u0430\u0441\u0441\u0430 <a href=\"https:\/\/www.php.net\/manual\/ru\/class.evio.php\" rel=\"noopener noreferrer nofollow\">EvIo<\/a> \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f ev:<\/p>\n<pre><code class=\"php\">public function subscribeHandler(FiberedHandler $handler): void {     foreach ($handler-&gt;getReadSockets() as $socket) {         if (!isset($this-&gt;watchers[$handler-&gt;getId()])) {             $watcher = new EvIo(socket_export_stream($socket), Ev::READ, [$this, 'handleEvent'], $handler-&gt;getId());             $watcher-&gt;start();             $this-&gt;watchers[$handler-&gt;getId()] = $watcher;         }     }     foreach ($handler-&gt;getWriteSockets() as $socket) {         if (!isset($this-&gt;watchers[$handler-&gt;getId()])) {             $watcher = new EvIo(socket_export_stream($socket), Ev::WRITE, [$this, 'handleEvent'], $handler-&gt;getId());             $watcher-&gt;start();             $this-&gt;watchers[$handler-&gt;getId()] = $watcher;         }     } }<\/code><\/pre>\n<p>\u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 EvIo \u043d\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043a\u043b\u0430\u0441\u0441\u0430 <a href=\"https:\/\/www.php.net\/manual\/ru\/class.socket.php\" rel=\"noopener noreferrer nofollow\">Socket<\/a> \u0430 \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u0441\u043a\u0430\u043b\u044f\u0440\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u0435\u043a\u0441\u0440\u0438\u043f\u0442\u043e\u0440\u0430, \u043d\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f  <a href=\"https:\/\/www.php.net\/manual\/ru\/function.socket-export-stream.php\" rel=\"noopener noreferrer nofollow\">socket_export_stream()<\/a> \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u043c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c. \u041f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 EvIo \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u043a\u043e\u043b\u043b\u0431\u044d\u043a handleEvent(), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d \u043f\u0440\u0438 \u043d\u0430\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0438 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u0437\u0430\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u0432\u0442\u043e\u0440\u044b\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c. \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043a\u043e\u043b\u043b\u0431\u044d\u043a handleEvent() \u0441\u043c\u043e\u0433 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0434\u043b\u044f \u0432\u044b\u0437\u043e\u0432\u0430 \u043f\u0440\u0438 \u043d\u0430\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0447\u0435\u0442\u0432\u0451\u0440\u0442\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 EvIo \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043a\u043e\u043b\u043b\u0431\u044d\u043a\u0430 handleEvent() \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d \u0432 \u043d\u0435\u0433\u043e \u0432 \u0441\u043e\u0441\u0442\u0430\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430:<\/p>\n<pre><code class=\"php\">public function handleEvent(EvIo $watcher): void {     if (!is_int($watcher-&gt;data)) {         App::error('Handler ID is missing.');          return;     }     $fiberedHandler = $this-&gt;handlerCollection-&gt;getHandlerById($watcher-&gt;data);     if ($fiberedHandler === null) {         App::error(\"Can't get socket event handler. Handler id: %s\", (int)$watcher-&gt;data);          return;     }     \/\/\u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u0435 watcher, \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 self::subscribeHandler()     $watcher-&gt;stop();     unset($this-&gt;watchers[$fiberedHandler-&gt;getId()]);     App::debug(\"Count of fibers: %d\", $this-&gt;handlerCollection-&gt;getCount());     $fiberedHandler-&gt;resetSockets();     if ($fiberedHandler-&gt;isSuspended()) {         $fiberedHandler-&gt;resume();         \/\/\u043d\u043e\u0432\u0430\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0430, \u0442.\u043a. \u0432 \u0441\u0442\u0440\u043e\u043a\u0430\u0445 \u0432\u044b\u0448\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0430 \u0431\u044b\u043b\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u0430         $this-&gt;subscribeHandler($fiberedHandler);     }     if (!$fiberedHandler-&gt;isStarted()) {         $fiberedHandler-&gt;start();         \/\/\u043d\u043e\u0432\u0430\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0430, \u0442.\u043a. \u0432 \u0441\u0442\u0440\u043e\u043a\u0430\u0445 \u0432\u044b\u0448\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0430 \u0431\u044b\u043b\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u0430         $this-&gt;subscribeHandler($fiberedHandler);     }     if ($fiberedHandler-&gt;isTerminated()) {         $this-&gt;handlerCollection-&gt;remove($fiberedHandler);     } }<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0438 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430 \u043f\u043e \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0443 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u043f\u0440\u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u0434\u043b\u044f \u0432\u044b\u0437\u043e\u0432\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a, \u0437\u0430\u0442\u0435\u043c, \u0435\u0441\u043b\u0438 \u0435\u0433\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u0444\u0430\u0439\u0431\u0435\u0440 \u0435\u0449\u0451 \u043d\u0435 \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u0430\u043b &#8212; \u043e\u043d \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u043e\u043d \u0431\u044b\u043b \u043f\u0440\u0438\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0438 \u043e\u0442\u0434\u0430\u043b \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 &#8212; \u0432\u043e\u0437\u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u0443\u0436\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0441\u044f &#8212; \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0437 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 handlerCollection. \u0415\u0441\u043b\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0431\u044b\u043b \u0437\u0430\u043f\u0443\u0449\u0435\u043d \u0438\u043b\u0438 \u0432\u043e\u0437\u043e\u0431\u043d\u043e\u0432\u043b\u0451\u043d, \u043f\u043e\u0441\u043b\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u043e\u0432\u0430\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0430 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0432\u0432\u043e\u0434\u0430\/\u0432\u044b\u0432\u043e\u0434\u0430, \u0435\u0441\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432\u0435\u0440\u043d\u0451\u0442 \u043a\u0430\u043a\u0438\u0435 \u043b\u0438\u0431\u043e \u0441\u043e\u043a\u0435\u0442\u044b \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0430\u0445 <a href=\"https:\/\/gitflic.ru\/project\/cleancodemonkey\/fabio\/blob?file=src%2FFiberedHandler.php&amp;branch=event#line-num-28\" rel=\"noopener noreferrer nofollow\">getReadSockets()<\/a> \u0438\u043b\u0438 <a href=\"https:\/\/gitflic.ru\/project\/cleancodemonkey\/fabio\/blob?file=src%2FFiberedHandler.php&amp;branch=event#line-num-31\" rel=\"noopener noreferrer nofollow\">getWriteSockets()<\/a>, \u0432\u044b\u0437\u043e\u0432\u044b \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u044b\u043b\u0438 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u0432\u044b\u0448\u0435.<\/p>\n<p>\u0412 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u043c \u0436\u0435 \u043a\u043e\u0434 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043e\u0441\u043e\u0431\u043e \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0441\u044f, \u0440\u0430\u0437\u0432\u0435 \u0447\u0442\u043e \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u043b\u0430\u0441\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430, \u0442.\u043a. \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u043b\u0430\u0441\u044c \u0438\u0445 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f:<\/p>\n<pre><code class=\"php\">declare(strict_types=1);  namespace CleanCodeMonkey\\Fabio;  class FiberedHandlerCollection {     \/** @var array&lt;int, FiberedHandler&gt; *\/     private array $handlers = [];      private App $app;      \/**      * @param App $app      *\/     public function __construct(App $app)     {         $this-&gt;app = $app;     }      public function push(FiberedHandler $handler): void     {         $this-&gt;handlers[$handler-&gt;getId()] = $handler;         $this-&gt;app-&gt;subscribeHandler($handler);     }      public function remove(FiberedHandler $handler): void     {         $id = $handler-&gt;getId();          if (isset($this-&gt;handlers[$id])) {             unset($this-&gt;handlers[$id]);         }     }      public function getCount(): int     {         return count($this-&gt;handlers);     }      public function getHandlerById(int $handlerId): ?FiberedHandler     {         return $this-&gt;handlers[$handlerId] ?? null;     }      \/**      * @return array&lt;int, FiberedHandler&gt;      *\/     public function getHandlers(): array     {         return $this-&gt;handlers;     } }<\/code><\/pre>\n<h2>\u0423\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f \u043f\u043e \u043e\u0442\u0437\u044b\u0432\u0430\u043c<\/h2>\n<p>\u0412 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u043a \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u0431\u044b\u043b\u043e \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u043e \u0437\u0430\u043c\u0435\u0447\u0435\u043d\u043e, \u0447\u0442\u043e \u0447\u0442\u0435\u043d\u0438\u0435 HTTP-\u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 \u0438\u0437 \u0441\u043e\u043a\u0435\u0442\u0430 \u043f\u043e 1 \u0431\u0430\u0439\u0442\u0443 \u0437\u0430 \u0432\u044b\u0437\u043e\u0432 socket_read() &#8212; \u043d\u0435 \u043b\u0443\u0447\u0448\u0430\u044f \u0438\u0434\u0435\u044f. \u041d\u0435 \u043c\u043e\u0433\u0443 \u043d\u0435 \u0441\u043e\u0433\u043b\u0430\u0441\u0438\u0442\u044c\u0441\u044f \u0441 \u044d\u0442\u0438\u043c, \u0430 \u043f\u043e\u0442\u043e\u043c\u0443 \u043f\u0435\u0440\u0435\u0434\u0435\u043b\u0430\u043b \u0447\u0442\u0435\u043d\u0438\u0435 HTTP-\u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u0422\u0435\u043f\u0435\u0440\u044c \u043a\u043e\u0434 \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0441\u0440\u0430\u0437\u0443 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432\u0441\u0435 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u0440\u0435\u0434\u0435\u043b \u0432 1024 \u0431\u0430\u0439\u0442\u0430. \u0415\u0441\u043b\u0438 \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 &#8212; \u0431\u0443\u0434\u0435\u0442 \u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0435\u0449\u0451 1024 \u0431\u0430\u0439\u0442\u0430, \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 &#8212; \u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442 \u0431\u044b\u043b\u0430 \u0437\u0430\u0445\u0432\u0430\u0447\u0435\u043d\u0430 \u0447\u0430\u0441\u0442\u044c \u0442\u0435\u043b\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043d\u043d\u044b\u043c\u0438 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430\u043c\u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u0430 \u0434\u0430\u043b\u0435\u0435 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 \u0442\u0435\u043b\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430.<\/p>\n<pre><code class=\"php\">private function readRequestHeaders(): RequestFragments {     $buffer = '';     $start = time();     while (true) {         $fragment = socket_read($this-&gt;acceptedSocket, self::HTTP_HEADERS_BUFFER_SIZE);         if ($fragment === false) {             $errorCode = socket_last_error($this-&gt;acceptedSocket);             socket_clear_error($this-&gt;acceptedSocket);             if (in_array($errorCode, [SOCKET_EAGAIN, SOCKET_EWOULDBLOCK])) {                 $this-&gt;addReadSocket($this-&gt;acceptedSocket);                 Fiber::suspend();                 if ($this-&gt;isTimeoutReached($start)) {                     App::debugFiber($this, 'Connection timed out while reading request headers. Socket error code: %d. Data: %s', $errorCode, json_encode($requestHeaders));                     throw new HttpRequestException('Connection timed out while reading request headers.');                 }                  continue;             }             if (!in_array($errorCode, [0, SOCKET_EINPROGRESS])) {                 throw new HttpRequestException(sprintf(\"Error reading data: %s\", socket_strerror($errorCode)));             }         }         $buffer .= $fragment;         if (strlen($buffer) &gt; self::MAX_HTTP_HEADERS_SIZE) {             throw new HttpRequestException('HTTP Request headers are too large.');         }         if (str_contains($buffer, \"\\r\\n\\r\\n\")) {             $separator = \"\\r\\n\\r\\n\";         } elseif (str_contains($buffer, \"\\r\\r\")) {             $separator = \"\\r\\r\";         } elseif (str_contains($buffer, \"\\n\\n\")) {             $separator = \"\\n\\n\";         } else {             $separator = '';         }         if (!empty($separator)) {             $fragments = explode($separator, $buffer);              return new RequestFragments($fragments[0] . $separator, $fragments[1] ?? '');         }         if (strlen($fragment) === 0) {             throw new HttpRequestException('HTTP Request is invalid.');         }     } }<\/code><\/pre>\n<h2>\u0411\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0438<\/h2>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441 \u0444\u0430\u0439\u0431\u0435\u0440\u0430\u043c\u0438:<\/p>\n<pre><code class=\"bash\">$ ab -c 1000 -n 10000 http:\/\/localhost:8085\/ Server Software: Server Hostname:        localhost Server Port:            8085  Document Path:          \/ Document Length:        244 bytes  Concurrency Level:      1000 Time taken for tests:   37.653 seconds Complete requests:      10000 Failed requests:        1108    (Connect: 0, Receive: 0, Length: 1108, Exceptions: 0) Non-2xx responses:      50 Total transferred:      2936789 bytes HTML transferred:       2425389 bytes Requests per second:    265.58 [#\/sec] (mean) Time per request:       3765.275 [ms] (mean) Time per request:       3.765 [ms] (mean, across all concurrent requests) Transfer rate:          76.17 [Kbytes\/sec] received<\/code><\/pre>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0430 PHP-FPM:<\/p>\n<pre><code class=\"bash\">$ ab -c 1000 -n 10000 http:\/\/localhost:8086\/ Server Software:        nginx\/1.27.2 Server Hostname:        localhost Server Port:            8086  Document Path:          \/ Document Length:        244 bytes  Concurrency Level:      1000 Time taken for tests:   76.497 seconds Complete requests:      10000 Failed requests:        927    (Connect: 0, Receive: 0, Length: 927, Exceptions: 0) Total transferred:      3666924 bytes HTML transferred:       2436924 bytes Requests per second:    130.72 [#\/sec] (mean) Time per request:       7649.725 [ms] (mean) Time per request:       7.650 [ms] (mean, across all concurrent requests) Transfer rate:          46.81 [Kbytes\/sec] received<\/code><\/pre>\n<p>~265 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443 \u043f\u0440\u043e\u0442\u0438\u0432 ~130 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443. \u0440\u0430\u0437\u043d\u0438\u0446\u0430 ~2 \u0440\u0430\u0437\u0430.<\/p>\n<h2>\u0412\u044b\u0432\u043e\u0434\u044b \u0438 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0435 \u043f\u043b\u0430\u043d\u044b<\/h2>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 ev \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u0441\u0435\u0433\u043e \u0434\u0432\u0443\u0445 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 <a href=\"https:\/\/www.php.net\/manual\/ru\/class.ev.php\" rel=\"noopener noreferrer nofollow\">Ev<\/a> \u0438 <a href=\"https:\/\/www.php.net\/manual\/ru\/class.evio.php\" rel=\"noopener noreferrer nofollow\">EvIo<\/a> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0431\u0435\u0437 \u0434\u043e\u0441\u0430\u0434\u043d\u043e\u0433\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u044b \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430, \u043f\u0440\u0438\u0441\u0443\u0449\u0435\u0433\u043e \u044f\u0432\u043d\u043e \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0435\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 socket_select(), \u0434\u0435\u043b\u0430\u044f \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 \u0436\u0438\u0437\u043d\u0435\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b\u043c. \u041f\u043e\u043c\u0438\u043c\u043e \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432 \u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0437\u0430 \u0441\u0447\u0451\u0442 \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 PHP \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 &#171;\u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430&#187;, \u0442\u0430\u043a\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u0442\u0430\u043a\u0436\u0435 \u0434\u0430\u0451\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432 \u043e\u0434\u043d\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441 \u0441\u0435\u0442\u0435\u0432\u044b\u043c\u0438 \u043a\u043e\u043d\u0442\u0440\u0430\u0433\u0435\u043d\u0442\u0430\u043c\u0438 (peers) \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 (\u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u0441\u043e\u043a\u0435\u0442 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430), \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u0438 \u0432\u044b\u0441\u043e\u043a\u043e\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0441 \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u0441\u0430\u043c\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0447\u0442\u043e \u0443\u0441\u0442\u0440\u0430\u043d\u044f\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c (\u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0437\u0430\u0442\u0440\u0430\u0442\u044b) \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0439 \u043f\u043e \u0441\u0435\u0442\u0438 \u043a \u0442\u0430\u043a\u0438\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u043c \u043a\u0430\u043a Redis \u0438\u043b\u0438 Memcached, \u043e\u0431\u044b\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u043c \u0434\u043b\u044f \u044d\u0442\u0438\u0445 \u0446\u0435\u043b\u0435\u0439. \u0418\u043d\u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u0438(\u0438\u043b\u0438) \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u044d\u0448\u0430 \u0432 \u0442\u0430\u043a\u0438\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u044f\u0445 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u043f\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u044f\u043c \u043e\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u0435\u0439, \u0447\u0438\u0442\u0430\u0435\u043c\u044b\u0445 \u0438\u0437 \u0441\u043e\u043a\u0435\u0442\u0430, \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f ev \u043d\u0430\u0440\u044f\u0434\u0443 \u0441 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435\u043c \u0441\u043e\u043a\u0435\u0442\u043e\u0432 HTTP-\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439. \u0412 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u044f \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u0443\u044e \u0432 \u0437\u0434\u0435\u0448\u043d\u0438\u0445 \u0432\u044b\u0432\u043e\u0434\u0430\u0445 \u043f\u0430\u0440\u0430\u0434\u0438\u0433\u043c\u0443.<\/p>\n<h2>\u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438<\/h2>\n<p>\u041f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f &#8212; <a href=\"https:\/\/habr.com\/ru\/articles\/866254\/\" rel=\"noopener noreferrer nofollow\">\u041f\u0440\u0438\u043c\u0435\u0440 HTTP-\u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043d\u0430 PHP \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0444\u0430\u0439\u0431\u0435\u0440\u043e\u0432 \/ \u0425\u0430\u0431\u0440<\/a>  <\/p>\n<p>\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440\u0430, \u0432\u0435\u0442\u043a\u0430 event &#8212; <a href=\"https:\/\/gitflic.ru\/project\/cleancodemonkey\/fabio\/file?branch=event\" rel=\"noopener noreferrer nofollow\">cleancodemonkey\/fabio<\/a>  <\/p>\n<p>\u0421\u0430\u0439\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 libevent &#8212; <a href=\"https:\/\/libevent.org\/\" rel=\"noopener noreferrer nofollow\">libevent<\/a>  <\/p>\n<p>C\u0430\u0439\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 libev &#8212; <a href=\"https:\/\/software.schmorp.de\/pkg\/libev.html\" rel=\"noopener noreferrer nofollow\">libev<\/a>  <\/p>\n<p>\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043a \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044e event &#8212; <a href=\"https:\/\/www.php.net\/manual\/ru\/book.event.php\" rel=\"noopener noreferrer nofollow\">PHP: Event &#8212; Manual<\/a>  <\/p>\n<p>\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043a \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044e ev, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 &#8212; <a href=\"https:\/\/www.php.net\/manual\/ru\/book.ev.php\" rel=\"noopener noreferrer nofollow\">PHP: Ev &#8212; Manual<\/a>  <\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/895580\/\"> https:\/\/habr.com\/ru\/articles\/895580\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 <a href=\"https:\/\/habr.com\/ru\/articles\/866254\/\" rel=\"noopener noreferrer nofollow\">\u041f\u0440\u0438\u043c\u0435\u0440 HTTP-\u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043d\u0430 PHP \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0444\u0430\u0439\u0431\u0435\u0440\u043e\u0432 \/ \u0425\u0430\u0431\u0440<\/a>  \u043a\u0440\u0430\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u044b\u043c \u043a\u0430\u043c\u043d\u0435\u043c \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 HTTP-\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <a href=\"https:\/\/www.php.net\/manual\/ru\/function.socket-select.php\" rel=\"noopener noreferrer nofollow\">socket_select()<\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 &#8212; \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043b\u044e\u0431\u043e\u0439 \u0438\u0437 \u0442\u0440\u0451\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 1024. \u0414\u0430\u043d\u043d\u044b\u0439 \u043b\u0438\u043c\u0438\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043e\u0439 FD_SETSIZE, \u0434\u043b\u044f \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u043b\u0438\u043c\u0438\u0442\u044b \u0438 \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440 PHP, \u0447\u0442\u043e \u043d\u0435\u0446\u0435\u043b\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u043e \u0438 \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b. \u041a \u0442\u043e\u043c\u0443 \u0436\u0435, \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <a href=\"https:\/\/manpages.org\/select\/2\" rel=\"noopener noreferrer nofollow\">select()<\/a>, \u043e\u0431\u0451\u0440\u0442\u043a\u043e\u0439 \u043d\u0430\u0434 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f socket_select(), \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0435\u0434\u0430\u0435\u0442 \u043f\u0440\u0438 \u043e\u0449\u0443\u0442\u0438\u043c\u043e\u043c \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b FD_SETSIZE. \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0443, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0443\u044e \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043e\u0442 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f. <\/p>\n<p>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 man-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0438 select, \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0430\u044e\u0449\u0438\u0439 \u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0435 \u0441 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u0430\u043c\u0438:<\/p>\n<pre><code>WARNING: select() can monitor only file descriptors numbers that        are less than FD_SETSIZE (1024)\u2014an unreasonably low limit for many        modern applications\u2014and this limitation will not change.  All        modern applications should instead use poll(2) or epoll(7), which        do not suffer this limitation.<\/code><\/pre>\n<p>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 Linux \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0430 Unix \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0443\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c, \u043f\u0440\u0438\u0441\u0443\u0449\u0438\u0445 \u0432\u044b\u0437\u043e\u0432\u0443 select(). \u0412 Linux \u0441\u0430\u043c\u043e\u0439 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0438 \u043b\u0438\u0448\u0451\u043d\u043d\u043e\u0439 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432 select() \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043e\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u044b\u0437\u043e\u0432 <a href=\"https:\/\/manpages.org\/epoll\/7\" rel=\"noopener noreferrer nofollow\">epoll()<\/a>. \u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0440\u0438\u0432\u044f\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u043a Linux \u0438 \u0432 \u0446\u0435\u043b\u044f\u0445 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0441\u0442\u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u0431\u044b\u043b\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <a href=\"https:\/\/libevent.org\/\" rel=\"noopener noreferrer nofollow\">libevent<\/a> \u0438 \u0435\u0439 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 (libev, libuv), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0432\u044b\u0437\u043e\u0432\u044b select, poll, epoll \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0432 \u0441\u0440\u0435\u0434\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u0412\u044b\u0431\u043e\u0440 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0441\u043e\u043a\u0435\u0442\u043e\u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0442\u0430\u043a\u0438\u043c\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u043c\u0438 \u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u043a\u043e\u0434\u0430. <\/p>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 libevent \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d\u0430 \u0431\u044b\u043b\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u0432 PHP \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f <a href=\"https:\/\/www.php.net\/manual\/ru\/book.event.php\" rel=\"noopener noreferrer nofollow\">event<\/a>. \u041e\u0434\u043d\u0430\u043a\u043e, API \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u044b\u0437\u043e\u0432\u0430 select(), \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0439 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f HTTP-\u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u043e\u0431\u043d\u044b\u043c \u0438 \u043d\u0430\u0434\u0451\u0436\u043d\u044b\u043c, \u043d\u043e \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0441\u043d\u0438\u0437\u0438\u0442\u044c \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c, \u0442.\u043a. \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043d\u0430 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u043e\u0432 \u0441\u043e\u043a\u0435\u0442\u043e\u0432 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 HTTP-\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439, \u043d\u043e \u0438 \u0441\u043e\u043a\u0435\u0442\u043e\u0432 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u0421\u0423\u0411\u0414 \u0438\u043b\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u043e\u0447\u0435\u0440\u0435\u0434\u0435\u0439. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u0432 PHP \u0442\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 <a href=\"https:\/\/www.php.net\/manual\/ru\/book.ev.php\" rel=\"noopener noreferrer nofollow\">ev<\/a>, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043a \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 <a href=\"https:\/\/github.com\/enki\/libev?tab=readme-ov-file\" rel=\"noopener noreferrer nofollow\">libev<\/a>, \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0434\u043b\u044f libevent. \u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0443\u0434\u043e\u0431\u043d\u043e\u0439 \u0437\u0430\u043c\u0435\u043d\u044b \u0434\u043b\u044f \u0432\u044b\u0437\u043e\u0432\u0430 socket_select(), \u0431\u0435\u0437 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0432 \u043a\u043e\u0434\u0435. \u0412\u0435\u0442\u043a\u0430 <a href=\"https:\/\/gitflic.ru\/project\/cleancodemonkey\/fabio?branch=event\" rel=\"noopener noreferrer nofollow\">event<\/a> \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u0441\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 socket_select() \u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f ev.<\/p>\n<h2>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u044b \u0432 \u043a\u043e\u0434\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430, \u0434\u043b\u044f \u0437\u0430\u043c\u0435\u043d\u044b \u0432\u044b\u0437\u043e\u0432\u0430 socket_select() \u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f ev<\/h2>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0431\u044b\u043b\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u044b \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 <a href=\"https:\/\/gitflic.ru\/project\/cleancodemonkey\/fabio\/blob?file=src%2FApp.php&amp;branch=event\" rel=\"noopener noreferrer nofollow\">CleanCodeMonkey\\Fabio\\App<\/a>. \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0446\u0438\u043a\u043b \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0442\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u043a\u043b\u044e\u0447\u0451\u043d \u0432 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0435 <a href=\"https:\/\/www.php.net\/manual\/ru\/ev.run.php\" rel=\"noopener noreferrer nofollow\">Ev::run()<\/a> \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"php\">public function run(): void {     App::debug(\"HTTP server has been started. Waiting for connections...\");     $supportedBackendNames = [];     $supportedBackends = Ev::supportedBackends();     if ($supportedBackends &amp; Ev::BACKEND_SELECT) {         $supportedBackendNames[Ev::BACKEND_SELECT] = 'select';     }     if ($supportedBackends &amp; Ev::BACKEND_POLL) {         $supportedBackendNames[Ev::BACKEND_POLL] = 'poll';     }     if ($supportedBackends &amp; Ev::BACKEND_EPOLL) {         $supportedBackendNames[Ev::BACKEND_EPOLL] = 'epoll';     }     if ($supportedBackends &amp; Ev::BACKEND_KQUEUE) {         $supportedBackendNames[Ev::BACKEND_KQUEUE] = 'kqueue';     }     if ($supportedBackends &amp; Ev::BACKEND_DEVPOLL) {         $supportedBackendNames[Ev::BACKEND_DEVPOLL] = 'devpoll';     }     if ($supportedBackends &amp; Ev::BACKEND_PORT) {         $supportedBackendNames[Ev::BACKEND_PORT] = 'port';     }     App::debug('Supported backends: %s, selected backend: %s', implode(', ', $supportedBackendNames), $supportedBackendNames[Ev::backend()] ?? 'unknown');     Ev::run(); }<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0435\u0434 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043e\u043c \u043a \u0446\u0438\u043a\u043b\u0443 \u0437\u0434\u0435\u0441\u044c \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0436\u0443\u0440\u043d\u0430\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u0431\u044d\u043a\u0435\u043d\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 libev (\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435\u043c ev). <\/p>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0446\u0438\u043a\u043b \u0432 \u0432\u044b\u0437\u043e\u0432\u0435 Ev::run() \u043d\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0441\u044f \u043f\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u0441\u043e\u043a\u0435\u0442\u043e\u0432, \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 App \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043d\u043e\u0432\u044b\u0445 HTTP-\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u0441\u043e\u043a\u0435\u0442\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430:<\/p>\n<pre><code class=\"php\">private function __construct(FiberedHandlerFactory $factory) {     $this-&gt;handlerCollection = new FiberedHandlerCollection($this);     $this-&gt;factory = $factory;     pcntl_async_signals(true);     pcntl_signal(SIGINT, [$this, 'interrupt']);     $serverSocket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);     if ($serverSocket === false) {         exit('Error creating server socket.');     }     if (!socket_set_nonblock($serverSocket)) {         exit('Error switching socket to the nonblocking mode.');     }     if (!socket_bind($serverSocket, getenv('HTTP_BIND_HOST'), (int)getenv('HTTP_BIND_PORT'))) {         exit('Error binding socket.');     }     if (!socket_listen($serverSocket, SOMAXCONN)) {         exit('Error switching socket to the listening mode.');     }     $this-&gt;handlerCollection-&gt;push($this-&gt;factory-&gt;createServerHandler($serverSocket, $this-&gt;handlerCollection)); }<\/code><\/pre>\n<p>\u041d\u0430 20 \u0441\u0442\u0440\u043e\u043a\u0435 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0430 \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u0432 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0443 \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043f\u043e \u0441\u043e\u043a\u0435\u0442\u0443:<\/p>\n<pre><code class=\"php\">public function push(FiberedHandler $handler): void {     $this-&gt;handlers[$handler-&gt;getId()] = $handler;     $this-&gt;app-&gt;subscribeHandler($handler); }<\/code><\/pre>\n<p>\u0412 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 subscribeHandler() \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0441\u043b\u0443\u0448\u0430\u0442\u0435\u043b\u0435\u0439 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0441\u043e\u043a\u0435\u0442\u043e\u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043b\u0430\u0441\u0441\u0430 <a href=\"https:\/\/www.php.net\/manual\/ru\/class.evio.php\" rel=\"noopener noreferrer nofollow\">EvIo<\/a> \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f ev:<\/p>\n<pre><code class=\"php\">public function subscribeHandler(FiberedHandler $handler): void {     foreach ($handler-&gt;getReadSockets() as $socket) {         if (!isset($this-&gt;watchers[$handler-&gt;getId()])) {             $watcher = new EvIo(socket_export_stream($socket), Ev::READ, [$this, 'handleEvent'], $handler-&gt;getId());             $watcher-&gt;start();             $this-&gt;watchers[$handler-&gt;getId()] = $watcher;         }     }     foreach ($handler-&gt;getWriteSockets() as $socket) {         if (!isset($this-&gt;watchers[$handler-&gt;getId()])) {             $watcher = new EvIo(socket_export_stream($socket), Ev::WRITE, [$this, 'handleEvent'], $handler-&gt;getId());             $watcher-&gt;start();             $this-&gt;watchers[$handler-&gt;getId()] = $watcher;         }     } }<\/code><\/pre>\n<p>\u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 EvIo \u043d\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043a\u043b\u0430\u0441\u0441\u0430 <a href=\"https:\/\/www.php.net\/manual\/ru\/class.socket.php\" rel=\"noopener noreferrer nofollow\">Socket<\/a> \u0430 \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u0441\u043a\u0430\u043b\u044f\u0440\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u0435\u043a\u0441\u0440\u0438\u043f\u0442\u043e\u0440\u0430, \u043d\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f  <a href=\"https:\/\/www.php.net\/manual\/ru\/function.socket-export-stream.php\" rel=\"noopener noreferrer nofollow\">socket_export_stream()<\/a> \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u043c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c. \u041f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 EvIo \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u043a\u043e\u043b\u043b\u0431\u044d\u043a handleEvent(), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d \u043f\u0440\u0438 \u043d\u0430\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0438 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u0437\u0430\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u0432\u0442\u043e\u0440\u044b\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c. \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043a\u043e\u043b\u043b\u0431\u044d\u043a handleEvent() \u0441\u043c\u043e\u0433 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0434\u043b\u044f \u0432\u044b\u0437\u043e\u0432\u0430 \u043f\u0440\u0438 \u043d\u0430\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0447\u0435\u0442\u0432\u0451\u0440\u0442\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 EvIo \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043a\u043e\u043b\u043b\u0431\u044d\u043a\u0430 handleEvent() \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d \u0432 \u043d\u0435\u0433\u043e \u0432 \u0441\u043e\u0441\u0442\u0430\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430:<\/p>\n<pre><code class=\"php\">public function handleEvent(EvIo $watcher): void {     if (!is_int($watcher-&gt;data)) {         App::error('Handler ID is missing.');          return;     }     $fiberedHandler = $this-&gt;handlerCollection-&gt;getHandlerById($watcher-&gt;data);     if ($fiberedHandler === null) {         App::error(\"Can't get socket event handler. Handler id: %s\", (int)$watcher-&gt;data);          return;     }     \/\/\u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u0435 watcher, \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 self::subscribeHandler()     $watcher-&gt;stop();     unset($this-&gt;watchers[$fiberedHandler-&gt;getId()]);     App::debug(\"Count of fibers: %d\", $this-&gt;handlerCollection-&gt;getCount());     $fiberedHandler-&gt;resetSockets();     if ($fiberedHandler-&gt;isSuspended()) {         $fiberedHandler-&gt;resume();         \/\/\u043d\u043e\u0432\u0430\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0430, \u0442.\u043a. \u0432 \u0441\u0442\u0440\u043e\u043a\u0430\u0445 \u0432\u044b\u0448\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0430 \u0431\u044b\u043b\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u0430         $this-&gt;subscribeHandler($fiberedHandler);     }     if (!$fiberedHandler-&gt;isStarted()) {         $fiberedHandler-&gt;start();         \/\/\u043d\u043e\u0432\u0430\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0430, \u0442.\u043a. \u0432 \u0441\u0442\u0440\u043e\u043a\u0430\u0445 \u0432\u044b\u0448\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0430 \u0431\u044b\u043b\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u0430         $this-&gt;subscribeHandler($fiberedHandler);     }     if ($fiberedHandler-&gt;isTerminated()) {         $this-&gt;handlerCollection-&gt;remove($fiberedHandler);     } }<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0438 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430 \u043f\u043e \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0443 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u043f\u0440\u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u0434\u043b\u044f \u0432\u044b\u0437\u043e\u0432\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a, \u0437\u0430\u0442\u0435\u043c, \u0435\u0441\u043b\u0438 \u0435\u0433\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u0444\u0430\u0439\u0431\u0435\u0440 \u0435\u0449\u0451 \u043d\u0435 \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u0430\u043b &#8212; \u043e\u043d \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u043e\u043d \u0431\u044b\u043b \u043f\u0440\u0438\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0438 \u043e\u0442\u0434\u0430\u043b \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 &#8212; \u0432\u043e\u0437\u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u0443\u0436\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0441\u044f &#8212; \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0437 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 handlerCollection. \u0415\u0441\u043b\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0431\u044b\u043b \u0437\u0430\u043f\u0443\u0449\u0435\u043d \u0438\u043b\u0438 \u0432\u043e\u0437\u043e\u0431\u043d\u043e\u0432\u043b\u0451\u043d, \u043f\u043e\u0441\u043b\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u043e\u0432\u0430\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0430 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0432\u0432\u043e\u0434\u0430\/\u0432\u044b\u0432\u043e\u0434\u0430, \u0435\u0441\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432\u0435\u0440\u043d\u0451\u0442 \u043a\u0430\u043a\u0438\u0435 \u043b\u0438\u0431\u043e \u0441\u043e\u043a\u0435\u0442\u044b \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0430\u0445 <a href=\"https:\/\/gitflic.ru\/project\/cleancodemonkey\/fabio\/blob?file=src%2FFiberedHandler.php&amp;branch=event#line-num-28\" rel=\"noopener noreferrer nofollow\">getReadSockets()<\/a> \u0438\u043b\u0438 <a href=\"https:\/\/gitflic.ru\/project\/cleancodemonkey\/fabio\/blob?file=src%2FFiberedHandler.php&amp;branch=event#line-num-31\" rel=\"noopener noreferrer nofollow\">getWriteSockets()<\/a>, \u0432\u044b\u0437\u043e\u0432\u044b \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u044b\u043b\u0438 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u0432\u044b\u0448\u0435.<\/p>\n<p>\u0412 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u043c \u0436\u0435 \u043a\u043e\u0434 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043e\u0441\u043e\u0431\u043e \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0441\u044f, \u0440\u0430\u0437\u0432\u0435 \u0447\u0442\u043e \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u043b\u0430\u0441\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430, \u0442.\u043a. \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u043b\u0430\u0441\u044c \u0438\u0445 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f:<\/p>\n<pre><code class=\"php\">declare(strict_types=1);  namespace CleanCodeMonkey\\Fabio;  class FiberedHandlerCollection {     \/** @var array&lt;int, FiberedHandler&gt; *\/     private array $handlers = [];      private App $app;      \/**      * @param App $app      *\/     public function __construct(App $app)     {         $this-&gt;app = $app;     }      public function push(FiberedHandler $handler): void     {         $this-&gt;handlers[$handler-&gt;getId()] = $handler;         $this-&gt;app-&gt;subscribeHandler($handler);     }      public function remove(FiberedHandler $handler): void     {         $id = $handler-&gt;getId();          if (isset($this-&gt;handlers[$id])) {             unset($this-&gt;handlers[$id]);         }    <\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-453883","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/453883","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=453883"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/453883\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=453883"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=453883"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=453883"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}