ejabberd icon indicating copy to clipboard operation
ejabberd copied to clipboard

ping_timeout when client is using CSI unavailable

Open wtomaszewski-applause opened this issue 2 years ago • 0 comments

Environment

  • ejabberd version: 21.12
  • Erlang version: Erlang/OTP 24
  • OS: macOS Monterey 12.4
  • Installed from: own fork for ejabberd 21.12

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 [email protected]/56c385d6-1fd2-4aec-8e6c-9f30f50fa5e2: Connection failed: ping_timeout

wtomaszewski-applause avatar Jul 05 '23 09:07 wtomaszewski-applause