8000 error in subscribe example · Issue #4 · php-mqtt/client · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
error in subscribe example #4
Closed
@medilies

Description

@medilies

i got the same error after many tests (maybe 10).
each test duration was between 30s and 90s while receiving messages (1 to 9 messages)!
ps: if not receiving any no problems happens!

code

<?php
use PhpMqtt\Client\MQTTClient;
require "vendor/autoload.php";

$server = 'localhost';
$port = '1883';
$clientId = 'test-subscriber';

$mqtt = new MQTTClient($server, $port, $clientId);
$mqtt->connect();
$mqtt->subscribe('php-client-sub', function ($topic, $message) {
    echo sprintf("Received message on topic [%s]: %s\n", $topic, $message);
}, 0);
$mqtt->loop(true);

error message

PHP Fatal error:  Uncaught PhpMqtt\Client\Exceptions\DataTransferException: [65] Transfering data over socket failed: Sending data over the socket failed. Has it been closed? in C:\xampp\htdocs\demo\mqtt_sub\vendor\php-mqtt\client\src\MQTTClient.php:1305
Stack trace:
#0 C:\xampp\htdocs\demo\mqtt_sub\vendor\php-mqtt\client\src\MQTTClient.php(349): PhpMqtt\Client\MQTTClient->writeToSocket('\xC0\x00')
#1 C:\xampp\htdocs\demo\mqtt_sub\vendor\php-mqtt\client\src\MQTTClient.php(670): PhpMqtt\Client\MQTTClient->ping()
#2 C:\xampp\htdocs\demo\mqtt_sub\index.php(14): PhpMqtt\Client\MQTTClient->loop(true)
#3 {main}
  thrown in C:\xampp\htdocs\demo\mqtt_sub\vendor\php-mqtt\client\src\MQTTClient.php on line 1305

Fatal error: Uncaught PhpMqtt\Client\Exceptions\DataTransferException: [65] Transfering data over socket failed: Sending data over the socket failed. Has it been closed? in C:\xampp\htdocs\demo\mqtt_sub\vendor\php-mqtt\client\src\MQTTClient.php on line 1305

PhpMqtt\Client\Exceptions\DataTransferException: [65] Transfering data over socket failed: Sending data over the socket failed. Has it been closed? in C:\xampp\htdocs\demo\mqtt_sub\vendor\php-mqtt\client\src\MQTTClient.php on line 1305

Call Stack:
    0.3939     398400   1. {main}() C:\xampp\htdocs\demo\mqtt_sub\index.php:0
    0.4084     840928   2. PhpMqtt\Client\MQTTClient->loop() C:\xampp\htdocs\demo\mqtt_sub\index.php:14
   24.4518     843288   3. PhpMqtt\Client\MQTTClient->ping() C:\xampp\htdocs\demo\mqtt_sub\vendor\php-mqtt\client\src\MQTTClient.php:670
   24.4519     843320   4. PhpMqtt\Client\MQTTClient->writeToSocket() C:\xampp\htdocs\demo\mqtt_sub\vendor\php-mqtt\client\src\MQTTClient.php:349

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0