How to set channel timeout?

I’m developing an app using state channels. Both clients connect each other and after the connection is set, if there are no events in the channel for 1 minute, the connection dies.
Reading the documentation in th sdk/es/channel/index.js:

**
 * Channel
 *
 * @function
 * @alias module:@aeternity/aepp-sdk/es/channel/index
 * @rtype Channel
 * @param {Object} options - Channel params
 * @param {String} options.url - Channel url (for example: "ws://localhost:3001")
 * @param {String} options.role - Participant role ("initiator" or "responder")
 * @param {String} options.initiatorId - Initiator's public key
 * @param {String} options.responderId - Responder's public key
 * @param {Number} options.pushAmount - Initial deposit in favour of the responder by the initiator
 * @param {Number} options.initiatorAmount - Amount of tokens the initiator has committed to the channel
 * @param {Number} options.responderAmount - Amount of tokens the responder has committed to the channel
 * @param {Number} options.channelReserve - The minimum amount both peers need to maintain
 * @param {Number} [options.ttl] - Minimum block height to include the channel_create_tx
 * @param {String} options.host - Host of the responder's node
 * @param {Number} options.port - The port of the responders node
 * @param {Number} options.lockPeriod - Amount of blocks for disputing a solo close
 * @param {Number} [options.existingChannelId] - Existing channel id (required if reestablishing a channel)
 * @param {Number} [options.offchainTx] - Offchain transaction (required if reestablishing a channel)
 * @param {Number} [options.timeoutIdle] - The time waiting for a new event to be initiated (default: 600000)
 * @param {Number} [options.timeoutFundingCreate] - The time waiting for the initiator to produce the create channel transaction after the noise session had been established (default: 120000)
 * @param {Number} [options.timeoutFundingSign] - The time frame the other client has to sign an off-chain update after our client had initiated and signed it. This applies only for double signed on-chain intended updates: channel create transaction, deposit, withdrawal and etc. (default: 120000)
 * @param {Number} [options.timeoutFundingLock] - The time frame the other client has to confirm an on-chain transaction reaching maturity (passing minimum depth) after the local node has detected this. This applies only for double signed on-chain intended updates: channel create transaction, deposit, withdrawal and etc. (default: 360000)
 * @param {Number} [options.timeoutSign] - The time frame the client has to return a signed off-chain update or to decline it. This applies for all off-chain updates (default: 500000)
 * @param {Number} [options.timeoutAccept] - The time frame the other client has to react to an event. This applies for all off-chain updates that are not meant to land on-chain, as well as some special cases: opening a noise connection, mutual closing acknowledgement and reestablishing an existing channel (default: 120000)
 * @param {Number} [options.timeoutInitialized] - the time frame the responder has to accept an incoming noise session. Applicable only for initiator (default: timeout_accept's value)
 * @param {Number} [options.timeoutAwaitingOpen] - The time frame the initiator has to start an outgoing noise session to the responder's node. Applicable only for responder (default: timeout_idle's value)
 * @param {Function} options.sign - Function which verifies and signs transactions
 * @return {Promise<Object>} Channel instance
 * @example Channel({
 *   url: 'ws://localhost:3001',
 *   role: 'initiator'
 *   initiatorId: 'ak_Y1NRjHuoc3CGMYMvCmdHSBpJsMDR6Ra2t5zjhRcbtMeXXLpLH',
 *   responderId: 'ak_V6an1xhec1xVaAhLuak7QoEbi6t7w5hEtYWp9bMKaJ19i6A9E',
 *   initiatorAmount: 1e18,
 *   responderAmount: 1e18,
 *   pushAmount: 0,
 *   channelReserve: 0,
 *   ttl: 1000,
 *   host: 'localhost',
 *   port: 3002,
 *   lockPeriod: 10,
 *   async sign (tag, tx) => await account.signTransaction(tx)
 * })
 */

I thought I have to modify timeoutIdle but it doesn’t update the value I need.
Which parameter should I set in order to allow the connection set for more time?

1 Like

Hi @fedecaccia,

There is an issue with the WebSocket ping and pong frames. This is already reported and a fix for it shall be delivered with v3.1. At the moment there is no timeout you can set to disable this but you can always send generic messages in order not to hit the 1-minute-no-messages timeout.

2 Likes

Thanks! it’s useful to know it!

2 Likes