processone / ejabberd

Robust, Ubiquitous and Massively Scalable Messaging Platform (XMPP, MQTT, SIP Server)
https://www.process-one.net/en/ejabberd/
Other
6.03k stars 1.5k forks source link

ping_timeout when client is using CSI unavailable #4057

Open wtomaszewski-applause opened 1 year ago

wtomaszewski-applause commented 1 year ago

Environment

Configuration (only if needed):

  websocket_ping_interval: 60
  websocket_timeout: 300
  mod_ping:
    send_pings: true
    ping_interval: 45 secs
    timeout_action: kill
  mod_client_state:
    queue_chat_states: true
    queue_presence: true

Errors from error.log/crash.log

No errors

Bug description

I have mobile strophejs client which has a logic to send CSI unavailable stanza when client is going to background mode. After client is disabled via CSI plugin, it is not able to receive ping requests and response to them and at the result the client connection is closing automatically by ping_timeout after few minutes sitting in background mode.

How to prevent that web-socket session from being killed via ping timeout as client is not longer able to response for ping requests but I want to have that connection to be stable till user will go to the available mode? In the client app I'm seeing Cannot read property 'send' of null from below code when client is trying to go to available mode after sitting in background mode for a while:

this._connection.send($pres({
      xmlns: Strophe.NS.CLIENT,
      type: 'available',
    }).c('csi', { xmlns: Strophe.NS.CSI }).up());

(websocket|<0.28201.4>) Closing c2s session for 560dbc22-44df-4f8e-a78e-d615c0e51393@...com/56c385d6-1fd2-4aec-8e6c-9f30f50fa5e2: Connection failed: ping_timeout