Installation and process registration
Requirements and package
The inspected MultiConnect source requires PHP ^8.1 and localzet/server ^7.0. Triangle Engine is not a package dependency. No tag or release was confirmed for the current source revision; check the version Composer actually resolves for your application.
composer require triangle/multiconnect
composer show triangle/multiconnect localzet/server
Create a handler
<?php
use localzet\Server\Connection\ConnectionInterface;
use Triangle\MultiConnect\GatewayServer;
final class EchoGateway extends GatewayServer
{
protected function onClientMessage(string $id, ConnectionInterface $connection, mixed $message): void
{
$this->connections()->sendToClient($id, $message);
}
}
Without Triangle, start Localzet Server with the handler class:
<?php
use localzet\Server;
localzet_start(
name: 'echo',
listen: 'websocket://127.0.0.1:7272',
count: 1,
handler: EchoGateway::class,
);
Server::runAll();
In a Triangle application, register the process in the application's config/process.php:
<?php
return [
'multiconnect' => [
'listen' => 'websocket://127.0.0.1:7272',
'count' => 1,
'handler' => EchoGateway::class,
],
];
This uses the same Server handler contract and does not require the Engine API. The example binds to loopback. Choose the bind address and TLS termination for your infrastructure before exposing it externally.

