請(qǐng)問(wèn)下目前想設(shè)計(jì)一個(gè)物聯(lián)網(wǎng)平臺(tái),通信框架使用WorkerMan還是GatewayWorkey框架,縮短開(kāi)發(fā)周期(不需要大量時(shí)間用在學(xué)習(xí)和設(shè)計(jì)通信部分)?之前我也接觸過(guò)很多開(kāi)源的平臺(tái)框架,但都停止維護(hù)了,很多依賴已經(jīng)找不到或者不支持了。
物聯(lián)網(wǎng)用GatewayWorkey比較合適。
請(qǐng)問(wèn)下如果我只想實(shí)現(xiàn) 客戶機(jī)的數(shù)據(jù)發(fā)送,服務(wù)器的接收以及存儲(chǔ)到服務(wù)器數(shù)據(jù)庫(kù)的話,是否只要關(guān)注 Applications/項(xiàng)目/Events.php 這個(gè)文件就可以了?
請(qǐng)問(wèn)下 這是什么錯(cuò)誤
pi@raspberrypi:/home/wwwroot/default/Workerman $ php tcp.php start
Failed loading /usr/local/zend/ZendGuardLoader.so: /usr/local/zend/ZendGuardLoader.so: cannot open shared object file: No such file or directory
PHP Warning: require_once(./Workerman/Autoloader.php): failed to open stream: No such file or directory in /home/wwwroot/default/Workerman/tcp.php on line 3
PHP Fatal error: require_once(): Failed opening required './Workerman/Autoloader.php' (include_path='.:/usr/local/php/lib/php') in /home/wwwroot/default/Workerman/tcp.php on line 3
<?php
use Workerman\Worker;
require_once __DIR__ . '/Workerman/Autoloader.php';
// 創(chuàng)建一個(gè)Worker監(jiān)聽(tīng)2345端口,使用http協(xié)議通訊
$http_worker = new Worker("http://0.0.0.0:2345");
// 啟動(dòng)4個(gè)進(jìn)程對(duì)外提供服務(wù)
$http_worker->count = 4;
// 接收到瀏覽器發(fā)送的數(shù)據(jù)時(shí)回復(fù)hello world給瀏覽器
$http_worker->onMessage = function($connection, $data)
{
// 向?yàn)g覽器發(fā)送hello world
$connection->send('hello world');
};
// 運(yùn)行worker
Worker::runAll();