HTTP::Server::EV::Buffer - Non-blocking output buffer.
$HTTP::Server::EV::Buffer::autoflush = 1024*10; # Default buffered data size in bytes when buffer starts waiting socket to be writable to send data. Setting 0 disables buffering, data will be sent as soon as socket becomes writable.
Creates new HTTP::Server::EV::Buffer object.
Prints data to buffer.
Sends all buffered data to socket and sets new flush threshold if $flush_threshold defined;
->flush only starts sending data in async background mode. ->flush_wait starts flushing and calls callback when all data is sent. If callback isn't specified it will try use Coro to block current thread (threading in PortListener must be enabled). If threading disabled and no callback specified it works as ->flush
Set onerror callback, which called when client disconeted before cerver closed connection.
Use when you need do some bi-directional communication through client socket(for ex. websocket server or make CONNECT proxy). Returns filehandle opened for RW and now buffer won't do anything with handle - $buffer will be set to undef; Call ->flush_wait before calling ->give_up_handle if you have data in buffer, otherwise it will be lost
Call this after ->new if you use H:S:E:Buffer without HTTP::Server::EV and need onerror callback. It's called automatically after receiving GET or POST request, for other methods you must start watcher manually after reading all data from handle.