One common method for checking the TCP connection is to send a space
character (U+0020) between XML stanzas, which is allowed for XML
streams as described under Section 11.7; the sending of such a space
character is properly called a "whitespace keepalive" (the term
"whitespace ping" is often used, despite the fact that it is not a
ping since no "pong" is possible).
The issue is that: when xmpp.js receives such a character - it can't parse it and fails with the below error
Logs
network_bot_prod | [Chat] RECV:
network_bot_prod | [Chat] ERROR: XMLError: must be a child.
network_bot_prod | at FramedParser.onText (/node_modules/@xmpp/xml/lib/Parser.js:63:26)
network_bot_prod | at SaxLtx.emit (events.js:400:28)
network_bot_prod | at SaxLtx.write (/node_modules/ltx/lib/parsers/ltx.js:102:20)
network_bot_prod | at FramedParser.write (/node_modules/@xmpp/xml/lib/Parser.js:71:17)
network_bot_prod | at Client._onData (/node_modules/@xmpp/connection/index.js:49:17)
network_bot_prod | at Socket.emit (events.js:400:28)
network_bot_prod | at WebSocket.listeners.message (/node_modules/@xmpp/websocket/lib/Socket.js:27:42)
network_bot_prod | at WebSocket.onMessage (/node_modules/ws/lib/event-target.js:132:16)
network_bot_prod | at WebSocket.emit (events.js:400:28)
network_bot_prod | at Receiver.receiverOnMessage (/node_modules/ws/lib/websocket.js:1008:20)
network_bot_prod | [Chat] SENT: <stream:error><bad-format xmlns="urn:ietf:params:xml:ns:xmpp-streams"/></stream:error>
network_bot_prod | [Chat] status - disconnecting
network_bot_prod | /node_modules/@xmpp/connection/index.js:49
network_bot_prod | this.parser.write(str)
network_bot_prod | ^
network_bot_prod |
network_bot_prod | TypeError: Cannot read property 'write' of null
network_bot_prod | at Client._onData (/node_modules/@xmpp/connection/index.js:49:17)
network_bot_prod | at Socket.emit (events.js:400:28)
network_bot_prod | at WebSocket.listeners.message (/node_modules/@xmpp/websocket/lib/Socket.js:27:42)
network_bot_prod | at WebSocket.onMessage (/node_modules/ws/lib/event-target.js:132:16)
network_bot_prod | at WebSocket.emit (events.js:400:28)
network_bot_prod | at Receiver.receiverOnMessage (/node_modules/ws/lib/websocket.js:1008:20)
network_bot_prod | at Receiver.emit (events.js:400:28)
network_bot_prod | at Receiver.dataMessage (/node_modules/ws/lib/receiver.js:517:14)
network_bot_prod | at Receiver.getData (/node_modules/ws/lib/receiver.js:435:17)
network_bot_prod | at Receiver.startLoop (/node_modules/ws/lib/receiver.js:143:22)
network_bot_prod | error Command failed with exit code 1.
Describe the bug
According to https://datatracker.ietf.org/doc/html/rfc6120#section-4.6.1 a sever can send whitespace keepalive character to detect dead connecton:
The issue is that: when xmpp.js receives such a character - it can't parse it and fails with the below error
Logs
Environment All envs, including web and node.js