Open yayuntian opened 1 year ago
It seems that the same happens for opcode 0x9 (PING). Or - to be preceise - the exception is thrown for anything other than opcode 0x2 (BINARY) and opcode 0x8 (CLOSE).
Unfortunately mosquitto seems to send PING WS-Frames form time-to time (exactly after 5 minutes; no matter how much activity was on the ws-connection before) This than triggerd all the side-effects of the last-will etc.
Took me several hours to find out that this is a bug in paho mqtt websocket implementation.
Sadly figuring this out took longer than writing an own NetworkModuleFactory
for websockets based on the jdk11 java.net websocket-client.
If websocket is ment to be supported the paho java mqtt client has at least cover the basic websocket-spec (like the opcodes and also respond to the PING frame with a PONG 0xA echoing the content)
Bug exists Release Version 1.2.5 ( Master Branch)
public WebSocketFrame(InputStream input) throws IOException { ..... throw new IOException("Invalid Frame: Opcode: " + this.opcode);
https://www.rfc-editor.org/rfc/rfc6455#section-5.2 SDK should support opcode 0