Skip to content
docs.
WORKSPACE

Your documentation

Explore the project catalog
Localzet ServerАсинхронный PHP-сервер✓TriangleФреймворк и компонентыMIX IDИдентификация и интеграцииHack APIПубличные API хакатонаACNПроект и компонентыUserlay / UserNetПроект и компонентыAxiomПроект и компонентыМесседжинг через почтуПроект и компонентыLWT / JWT / JOSEПроект и компонентыФинансовая аналитика KimaiПроект и компонентыМультипарадигмальная БДПроект и компонентыZorin PlatformПроект и компонентыZorin TrustПроект и компонентыFloraScope / VegwatchПроект и компонентыaegis-qДокументация проектаaevumdbДокументация проектаauditДокументация проектаauto-invest-managerАвтотрейдерcaine-companionДокументация проектаcertbot-cloudflareДокументация проектаClusterLocalzet Server / ClustercmdveilДокументация проектаConsolePHP CLICronБиблиотеки Localzet Serverdata-connectorДокументация проектаdevice-controlDevice Controlenn-projectДокументация проектаEventsБиблиотеки Localzet ServerflowsintДокументация проектаforgeДокументация проектаHttpClientБиблиотеки Localzet ServerinterpreterСобственный языкinvariaДокументация проектаkeynotesДокументация проектаknotrouteKnotroutelaravel-personal-analyticsДокументация проектаlocalzet-osДокументация проектаmeridianДокументация проектаMQTTБиблиотеки Localzet Servernano-kernelСобственная ОСNoterДокументация проектаpersonal-analyticsДокументация проектаProxyБиблиотеки Localzet ServerPSRБиблиотеки Localzet ServerPSR-7Библиотеки Localzet Serverrschs-monitorДокументация проектаsemsealДокументация проектаshardsealДокументация проектаSocketIOБиблиотеки Localzet ServerSOCKS5Библиотеки Localzet Serverstandalone-analyticsДокументация проектаstatic-php-cliДокументация проектаStorageБиблиотеки Localzet ServersutureДокументация проектаtempoweaveДокументация проектаttsСинтез речиTunnelБиблиотеки Localzet Serverui-kitUI KitvesperДокументация проектаWebAnalyzerWebAnalyzerzorin-access-brokerДокументация проектаzorin-authority-brokerДокументация проектаzorin-authority-sdk-phpДокументация проектаzorin-authority-sdk-pythonДокументация проектаzorin-authority-sdk-tsДокументация проектаzorin-client-intelДокументация проектаzorin-device-core-aospДокументация проектаzorin-host-agentДокументация проектаzorin-native-labДокументация проектаzorin-nodeДокументация проектаzorin-opsДокументация проектаdonstu-python-sdkДокументация проектаfloortraceFloortraceserver-rsLocalzet Server / Cluster
Catalog
Documentation/Localzet Server

Connections and flow control

TcpConnection represents one TCP connection. HTTP, Text and WebSocket use this transport with different codecs. AsyncTcpConnection creates outbound connections.

send($data, $raw = false): ?bool calls protocol encode unless raw=true. true means success on the local send path, not confirmation that the remote application processed the message. false indicates an error/closed connection; null indicates queued data or empty codec output. Data may remain buffered until TCP/TLS establishment or socket availability.

close($data = null, $raw = false) sends remaining data and closes after the buffer drains. end() handles write completion with linger/half-close. destroy() releases the socket immediately. During HTTP file streaming, close/end are deferred through stream lifecycle.

getSendBufferQueueSize(), getRecvBufferQueueSize() and bufferIsEmpty() inspect queues. maxSendBufferSize and maxPackageSize limit a connection; static defaults apply when it is created.

Stop producing data on onBufferFull and resume on onBufferDrain. pauseRecv()/resumeRecv() control reading. Never busy-loop on send when the buffer is full.

$source->pipe($destination) assigns source onMessage/onClose and destination onBufferFull/onBufferDrain callbacks, replacing previous assignments. A bidirectional relay pipes both directions; authorization and destination policy belong to the application.

new AsyncTcpConnection($remoteAddress, $socketContext = [], $eventLoop = null) creates the object; connect() starts establishment. setConnectTimeout($seconds) limits it. reconnect($after) schedules another attempt; cancelReconnect() cancels it. Clean up old timers/subscriptions before registering application logic again.

setIdleTimeout(), setFrameTimeout() and setTlsHandshakeTimeout() bound TcpConnection stages. Set a separate application request deadline: an active connection may never return the required answer.

Exact signatures · HTTP requests · Streaming examples