Closed aswathykrishnan92 closed 5 years ago
@randomsync Hi, were you able to check this?
Hi @aswathykrishnan92
| *Test Cases*
| Publish and Subscribe
| | Connect | 127.0.0.1
| | Publish | topic=MQTTTest2 | message=test message
| | [Teardown] | Disconnect
If you look at this pub sub test case: https://github.com/randomsync/robotframework-mqttlibrary/blob/master/tests/pubsub.txt#L14, it subscribes first with a defined client id and expects that it won't get the message. Then it publishes a message with qos 1. Then it subscribes again with same client id and qos=1 to validate that it received the message.
If you'd like to subscribe first and get the messages later (async), you can look at this test case: https://github.com/randomsync/robotframework-mqttlibrary/blob/master/tests/pubsub.txt#L158
So. I have brought up a mosquitto broker using mosquitto -v. I have subscribed to topic MQTTTest2 and published for which I am getting the publish message correctly.
I try to replicate this via robot framework. I am able to publish a message just fine. But when I try to subscribe to the topic, I am getting a socket exception
1544001640: Sending PINGRESP to mosqsub|12144-BLRKEC334 1544001654: New connection from 127.0.0.1 on port 1883. 1544001654: New client connected from 127.0.0.1 as g:qmePxeTV?=tmm7?22Y9nZD2 aoGIQk[M[FhiQnB>v\A8[Z64AF>\tbPx3K (c1, k60). 1544001654: No will message specified. 1544001654: Sending CONNACK to g:qmePxeTV?=tmm7?22Y9nZD2A?aoGIQk[M[FhiQnB>v\ [Z64AF>\tbPx3K (0, 0) 1544001654: Received PUBLISH from g:qmePxeTV?=tmm7?22Y9nZD2A?aoGIQk[M[FhiQnB \A8[Z64AF>\tbPx3K (d0, q2, r0, m1, 'MQTTTest2', ... (11 bytes)) 1544001654: Sending PUBREC to g:qmePxeTV?=tmm7?22Y9nZD2A?aoGIQk[M[FhiQnB>v\A [Z64AF>\tbPx3K (Mid: 1) 1544001654: Received PUBREL from g:qmePxeTV?=tmm7?22Y9nZD2A?aoGIQk[M[FhiQnB> A8[Z64AF>\tbPx3K (Mid: 1) 1544001654: Sending PUBCOMP to g:qmePxeTV?=tmm7?22Y9nZD2A?aoGIQk[M[FhiQnB>v\ [Z64AF>\tbPx3K (Mid: 1) 1544001654: Sending PUBLISH to mosqsub|12144-BLRKEC334 (d0, q0, r0, m0, 'MQTTT t2', ... (11 bytes)) 1544001654: Sending PUBLISH to mosqsub|1540-BLRKEC3344 (d0, q0, r0, m0, 'MQTTT t2', ... (11 bytes)) 1544001654: Received DISCONNECT from g:qmePxeTV?=tmm7?22Y9nZD2A?aoGIQk[M[Fhi B>v\A8[Z64AF>\tbPx3K 1544001654: Client g:qmePxeTV?=tmm7?22Y9nZD2A?aoGIQk[M[FhiQnB>v\A8[Z64AF>\t x3K disconnected. 1544001654: New connection from 127.0.0.1 on port 1883. 1544001654: New client connected from 127.0.0.1 as 1589-BLRKEC3344 (c1, k60). 1544001654: No will message specified. 1544001654: Sending CONNACK to 1589-BLRKEC3344 (0, 0) 1544001654: Received SUBSCRIBE from 1589-BLRKEC3344 1544001654: MQTTTest2 (QoS 2) 1544001654: 1589-BLRKEC3344 2 MQTTTest2 1544001654: Sending SUBACK to 1589-BLRKEC3344 1544001656: Socket error on client 1589-BLRKEC3344, disconnecting.
Below is the code I used: Publish Connect 127.0.0.1 Publish topic=MQTTTest2 message=test message [Teardown] Disconnect Subsribe and Validate Connect 127.0.0.1 client_id=1589-BLRKEC3344 Subscribe and Validate topic=MQTTTest2 qos=1 payload=test [Teardown] Disconnect
The publish part is working fine and I am able to see the message in cmd window. But the subscribe part gives socket exception. Please not that I have given the clientID randomly with reference to the Ping request from the other subscribers already started. I tried with and without client id. I am having the same issue. Please help me out?