Pass Variable onOpen PHP Ratchet Websockets

0

How can I pass the internal user code in the Ratchet PHP onOpen function? I need to pass the code to be able to mark the user with the online status;

public function onOpen(ConnectionInterface $conn){
        $this->clients->attach($conn);
        $this->users[$conn->resourceId] = $conn;

        echo "New connection! " . $CODIGO_USUARIO . "\n";

        //grava o status
        $db = new \PDO("mysql:host=localhost;dbname=rjacos_producao", "root", "root"); 

        $stmt = $db->query("update funcionarios set online=1 where mat_func = '" . $CODIGO_USUARIO  . "'");

    }
    
asked by anonymous 27.06.2018 / 18:21

0 answers