eclipse-paho / eclipse-paho/paho.mqtt.java

paho.mqtt.java does not handle ping/pong requests from libwebsocket

Open
#912 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.3k
Forks
919
PR merge metrics
No merged PRs in 30d

Description

- [X] Bug exists Release Version 1.2.5 ( Master Branch)

Hi.
We are using the Mosquitto MQTT server along with libwebsocket library (https://libwebsockets.org) v4.1. On client side we use the paho.mqtt.java library (v1.2.5). MQTT Protocoll version is v3.1.

Problem:
The MQTT broker frequently triggers every 5min a client ping request and the libwebsocket sends this request to the Java client.
The WebSocketFrame.java receives this ping request (Opcode = 0x9) and throws an IOException("Invalid Frame: Opcode: 9") (line 193). This exception ist catched in WebSocketReceiver.java (L121) and results in a close of the connection.

Expected behaviour:
When the paho.mqtt.java library is receiving the ping opcode (0x9) (https://datatracker.ietf.org/doc/html/rfc6455#section-5.5.2) it replies the request with the pong code (0xA) (https://datatracker.ietf.org/doc/html/rfc6455#section-5.5.3).

Can you please fix the ping/pong handling in paho.mqtt.java. Would be great.
Regards, Hans

Contributor guide

Open the contributing guide

Research direction

Read WebSocketFrame.java around line 193 and WebSocketReceiver.java around line 121, then compare the handling of opcode 0x9 with RFC 6455 sections 5.5.2 and 5.5.3. Reproduce the connection-close behavior with a Mosquitto/libwebsocket broker setup. Done means a received ping is handled without closing the connection and receives the expected pong response.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.