We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
怎样在server.php中监听http请求,当接收到http请求时触发对浏览器client的emit事件?
这样写貌似不可以
$io = new SocketIO(2020); $io->on('connection', function($connection)use($io,$http_worker){ $connection->emit('server start', '服务器已启动'); echo date('Y-m-d H:i:s')." | ".'Linked'."\n";
$http_worker->onMessage = function($conn, $data)use($connection) { echo date('Y-m-d H:i:s')." | ".'Http'."\n"; $connection->emit('server msg', '服务器发送消息'.date('Y-m-d H:i:s')); }; $connection->on('disconnect', function () { echo date('Y-m-d H:i:s')." | ".'Lost'."\n"; });
});
其中$http_worker是已经实例化的http类型workmen对象
The text was updated successfully, but these errors were encountered:
这里有个例子 https://github.com/walkor/web-msg-sender/blob/master/start_io.php#L58
Sorry, something went wrong.
No branches or pull requests
怎样在server.php中监听http请求,当接收到http请求时触发对浏览器client的emit事件?
这样写貌似不可以
$io = new SocketIO(2020);
$io->on('connection', function($connection)use($io,$http_worker){
$connection->emit('server start', '服务器已启动');
echo date('Y-m-d H:i:s')." | ".'Linked'."\n";
});
其中$http_worker是已经实例化的http类型workmen对象
The text was updated successfully, but these errors were encountered: