ikarus/sps-server

v0.1.5 2020-04-21 19:18 UTC

This package is auto-updated.

Last update: 2024-09-22 06:05:17 UTC


README

Ikarus SPS的服务器包提供插件以建立到正在运行的sps的Unix和/或TCP连接。

安装

$ composer require ikarus/sps-server

使用

循环

<?php
use Ikarus\SPS\CyclicEngine;
use Ikarus\SPS\Server\Cyclic\ServerPlugin;

$sps = new CyclicEngine(2, 'Test SPS');
// add the plugins your need to run properly

$sps->addPlugin( new ServerPlugin('192.168.1.100', 8686) );
$sps->run();

触发

<?php
use Ikarus\SPS\TriggeredEngine;
use Ikarus\SPS\Server\Trigger\ServerPlugin;

$sps = new TriggeredEngine('Test SPS');
// add the plugins your need to run properly

$sps->addPlugin( new ServerPlugin('192.168.1.100', 8686) );
// or local unix server
$sps->addPlugin( new ServerPlugin('/tmp/example-sps.sock') );
$sps->run();

现在任何应用程序都可以通过tcp://192.168.1.100在端口8686上调用sps。

请注意,我们不推荐添加超过一个服务器插件。SPS会接受它们,但可能会引起冲突。