I'm new to the PHP world, facing problem while connecting to MQTT.
I'm using the phpMQTT.php library, and I'm using the IP address to connect to the MQTT broker. I'm trying to publish to MQTT broker, getting error in phpMQTT.php library file
The error is: stream_socket_client(): unable to connect to tcp://...*:8083 (Connection timed out)
facing problem in below code:
if ($this->cafile) {
$socketContext = stream_context_create(["ssl" => [
"verify_peer_name" => true,
"cafile" => $this->cafile
]]);
$this->socket = stream_socket_client("tls://" . $this->address . ":" . $this->port, $errno, $errstr, 60, STREAM_CLIENT_CONNECT, $socketContext);
} else {
$this->socket = stream_socket_client("tcp://" . $this->address . ":" . $this->port, $errno, $errstr, 60, STREAM_CLIENT_CONNECT);
}