Answer the question
In order to leave comments, you need to log in
How to install websocket on Lumen (Laravel)?
I can’t solve this problem: I installed the websocket package
on Lumen
I took the most common example examples,
Server:
require_once('vendor/autoload.php');
$socket = new \HemiFrame\Lib\WebSocket\WebSocket("localhost", 8080);
$socket->on("receive", function($client, $data) use($socket) {
foreach ($socket->getClients() as $item) {
/* @var $item \HemiFrame\Lib\WebSocket\Client */
if ($item->id != $client->id) {
$socket->sendData($item, $data);
}
}
});
$socket->startServer();
require_once('vendor/autoload.php');
$socket = new \HemiFrame\Lib\WebSocket\WebSocket('localhost', 8080);
$socket->on("receive", function($client, $data) use($socket) {
});
$client = $socket->connect();
if ($client) {
$socket->sendData($client, "Message");
$socket->disconnectClient($client);
}
var conn = new WebSocket('ws://sender.com:8080/api/echo');
console.log(conn);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question