Answer the question
In order to leave comments, you need to log in
Unable to save data to the database (Ratchet)?
Wrote a simple chat with Ratchet
public function onMessage(ConnectionInterface $from, $msg)
{
DB::table('chat')->insert([
'visa_order_id' => 1,
'user_id' => 1,
'text' => 1,
]);
}
An error has occurred: A facade root has not been set.
Connection 53 has disconnected
Answer the question
In order to leave comments, you need to log in
public function onMessage(ConnectionInterface $from, $msg) {
$numRecv = count($this->clients) - 1;
echo sprintf('Connection %d sending message "%s" to %d other connection%s' . "\n"
, $from->resourceId, $msg, $numRecv, $numRecv == 1 ? '' : 's ');
foreach ($this->clients as $client) {
$client->send($this->response->make($msg));
$ms=json_decode($msg);
$ms= (object)$ms;
\App\Messages::create(['body'=>$session_name,'user_id'=>$ms->client->data->user_id,'chat_id'=>1]);
}
}
works like this for me
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question