The onclose and onconnect interfaces in the swoole extension of php are not called, swooleonclose. The onclose and onconnect interfaces in the swoole extension of php are not called. swooleonclose encountered a problem when using the swoole extension to write online chat examples and checked a lot of information, note that the onclose and onconnect interfaces in the swoole extension of php are not called. swooleonclose
I encountered a problem when using the swoole extension to write online chat examples. I checked a lot of information and recorded it here.
By reading the swoole_server interface documentation, the callback registration interface on has a clear note:
* swoole_server->on & swoole_http_server->on are the same except swoole_http_server : * - not accepting onConnect/onReceive callback accept events onRequest
Swoole_http_server and swoole_server are basically the same, but swoole_http_server does not call the connect and receive interfaces and should call the request interfaces.
Swoole_websocket_server is used in small chat examples. the receive interface in swoole_websocket_server is not called by test, but as a persistent connection service, in worker
The callback in close and connect is still necessary. For example, online broadcast notifications and offline broadcast notifications must be called back to the corresponding interfaces. Therefore, the official website must support callback.
Finally, the problem was found through a swoole version update announcement.
Swoole-1.7.16 version released, BUG fixes:
Added swoole_server-> tick and swoole_timer_tick functions.
Added http server support for gzip compression
Add swoole_table-> incr/decr Atomic Auto-increment/auto-increment method
Added the open_eof_split configuration. EOF detection supports automatic subcontracting.
Add server statistical items request_count and worker_request_count
Add the server connection iterator. you can use foreach to traverse all the connections on the server.
Add query_string for http server requests
Added support for multipart-form and file upload on the http server.
Fixed the BUG of onReceive data merging failure.
Fixed the BUG where swoole_server-> addtimer conflicts with tick timer.
Fixed the problem that Accept is not blocked in earlier Linux versions.
Fixed the problem of repeated log printing by Too transaction Connection returned when the Accept fails.
Fixed the problem where the task_max_request parameter was invalid.
Fixed the problem that the waitall parameter of swoole_client was invalid.
Fixed the BUG of swoole_table endless loops.
The 2nd parameters of the onOpen callback function of the WebSocket server are changed from $ fd to $ request object.
Http server allows sending response with empty body
Disable swoole_websocket_server-> send method
The BASE mode supports sending data to any FD.
Set dispatch_mode = 1, 3 and disable onClose/onConnect event callback
Allows the Worker process to set non-system reserved signals
Removes the dependency of the bottom layer of swoole on object resource attributes and directly reads pointers to improve performance.
Solve the problem that heartbeat threads cannot forcibly kill legacy connections.
Optimized dispatch_mode = 3 to improve task allocation efficiency
Is a problem with the worker allocation mode. In preemptible mode and polling mode, these two callback interfaces are not called. In the fixed mode, the data packets of each client are processed by a fixed worker process, so that some private information belonging to the client can be stored in the worker process and some frequently read/write data can be cached, it is similar to the process code in erlang. In this way, the client needs to perform some cleanup operations when it is offline. Launch initialization. Therefore, this mode is meaningful and necessary. The fixed mode is applicable when the logic of each client is relatively uniform.
Parse encountered a problem when using swoole extension to write online chat examples. I checked a lot of information...