Commit 3206e58b authored by Mat's avatar Mat

on nettoie, pour reprendre tout pas à pas

parent 8618f390
......@@ -23,18 +23,11 @@
let connection = new WebSocket('ws://0.0.0.0:8088/');
connection.onopen = function(e)
{
$("#send").click(function()
{
let message = $('#message').val();
connection.send(message);
connection.onopen = function(e) {
});
};
connection.onmessage = function(e)
{
console.log(JSON.parse(e.data));
connection.onmessage = function(e) {
};
});
......
......@@ -52,8 +52,6 @@ class ChatHub implements MessageComponentInterface
{
echo "Un utilisateur s'est connecté\n";
$this->clients[] = $conn;
$response = json_encode([
'type' => 'msg_server',
'author' => 'server',
......@@ -61,9 +59,6 @@ class ChatHub implements MessageComponentInterface
'timestamp' => (new \DateTime())->getTimestamp()
]);
// le prof montre d'abord ceci :
//$this->container->get("security.token_storage")->getToken()->getUser();
$conn->send($response);
}
......@@ -111,20 +106,6 @@ class ChatHub implements MessageComponentInterface
*/
function onMessage(ConnectionInterface $from, $msg)
{
echo "Le message '". $msg ."' a été reçu\n";
$tokenManager = $this->container->get('lexik_jwt_authentication.jwt_manager');
foreach ($this->clients as $client)
{
$response = json_encode([
'type' => 'msg_from_user',
'author' => "",
'content' => $msg,
'timestamp' => (new \DateTime())->getTimestamp()
]);
$client->send($response);
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment