soketi icon indicating copy to clipboard operation
soketi copied to clipboard

Soketi sends a webhook during client reconnection

Open hubertnnn opened this issue 1 year ago • 0 comments

Description Based on pusher specification:

There is a delay of up to three seconds between a client disconnecting 
and channel_vacated or member_removed webhooks being sent. 
If the client reconnects within this delay, no webhooks will be sent.

Socketi does send a series of events on fast reconnections.

Reproduction steps Steps to reproduce the behavior:

  1. Setup webhooks
  2. Enter a presence channel
  3. Press F5 in your browser
  4. Webhooks are sent about disconnection immediately followed by reconnection webhooks

Expected behavior Client should reconnect and no webhooks should be sent.

Environment

  • Soketi version (i.e. 1.3.0): 1.4.0
  • Adapter (local, redis): redis
  • App Manager (array, mysql, postgres, dynamodb) : array
  • Queue (sqs, redis, sync): redis
  • Cache Managers (memory, redis): memory

Configuration Run the server with SOKETI_DEBUG=1 and paste the nested object configuration that outputs:

{
  adapter: { driver: 'redis', redis: { prefix: 'soketi-data' } },
  appManager: {
    driver: 'array',
    cache: { enabled: false, ttl: -1 },
    array: {
      apps: [
        {
          id: 'wms',
          key: 'wms',
          secret: 'XXXXXXXX',
          webhooks: [
            {
              url: 'https://api.wms.proj/_callback/pusher',
              event_types: [
                'channel_occupied',
                'channel_vacated',
                'member_added',
                'member_removed'
              ]
            }
          ]
        }
      ]
    },
    dynamodb: { table: 'apps', region: 'us-east-1', endpoint: null },
    mysql: { table: 'apps', version: '8.0', useMysql2: false },
    postgres: { table: 'apps', version: '13.3' }
  },
  cache: { driver: 'memory', redis: { redisOptions: {}, clusterMode: false } },
  channelLimits: { maxNameLength: 200, cacheTtl: 3600 },
  cluster: {
    hostname: '0.0.0.0',
    helloInterval: 500,
    checkInterval: 500,
    nodeTimeout: 2000,
    masterTimeout: 2000,
    port: 11002,
    prefix: '',
    ignoreProcess: true,
    broadcast: '255.255.255.255',
    unicast: null,
    multicast: null
  },
  cors: {
    credentials: true,
    origin: [ '*' ],
    methods: [ 'GET', 'POST', 'PUT', 'DELETE', 'OPTIONS' ],
    allowedHeaders: [
      'Origin',
      'Content-Type',
      'X-Auth-Token',
      'X-Requested-With',
      'Accept',
      'Authorization',
      'X-CSRF-TOKEN',
      'XSRF-TOKEN',
      'X-Socket-Id'
    ]
  },
  database: {
    mysql: {
      host: '127.0.0.1',
      port: 3306,
      user: 'root',
      password: 'password',
      database: 'main'
    },
    postgres: {
      host: '127.0.0.1',
      port: 5432,
      user: 'postgres',
      password: 'password',
      database: 'main'
    },
    redis: { host: '127.0.0.1', port: 6379, keyPrefix: 'soketi' }
  },
  databasePooling: { enabled: false, min: 0, max: 7 },
  debug: true,
  eventLimits: {
    maxChannelsAtOnce: 100,
    maxNameLength: 200,
    maxPayloadInKb: 100,
    maxBatchSize: 10
  },
  host: '0.0.0.0',
  httpApi: { requestLimitInMb: 100, acceptTraffic: { memoryThreshold: 85 } },
  instance: { process_id: 29886 },
  metrics: {
    enabled: false,
    driver: 'prometheus',
    host: '0.0.0.0',
    prometheus: { prefix: 'soketi_' },
    port: 9601
  },
  mode: 'full',
  port: 6001,
  pathPrefix: '',
  presence: { maxMembersPerChannel: 100, maxMemberSizeInKb: 2 },
  queue: {
    driver: 'redis',
    redis: { concurrency: 1, redisOptions: {}, clusterMode: false },
    sqs: {
      region: 'us-east-1',
      endpoint: null,
      clientOptions: {},
      consumerOptions: {},
      queueUrl: '',
      processBatch: false,
      batchSize: 1,
      pollingWaitTimeMs: 0
    }
  },
  rateLimiter: { driver: 'local', redis: { redisOptions: {}, clusterMode: false } },
  shutdownGracePeriod: 3000,
  ssl: { certPath: '', keyPath: '', passphrase: '', caPath: '' },
  userAuthenticationTimeout: 30000,
  webhooks: { batching: { enabled: false, duration: 50 } }
}

hubertnnn avatar Sep 01 '22 09:09 hubertnnn