Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Duplicate messages being sent to client #1026

Open
jackkitley opened this issue Nov 1, 2023 · 2 comments
Open

[BUG] Duplicate messages being sent to client #1026

jackkitley opened this issue Nov 1, 2023 · 2 comments
Assignees
Labels
status:triage Awaiting triage.

Comments

@jackkitley
Copy link

jackkitley commented Nov 1, 2023

Description
Im using soketi with Laravel 10 + Redis. I have occassions when i broadcast a message once that soketi somehow has duplicates of the same message. I have debugged laravel side as we as the messages in console from sockets and that only comes through once. Running debug on soketi container i see 2x message.

Reproduction steps
Steps to reproduce the behavior:

  1. With Laravel i broadcast a notification from a Job. Both are queued. But i get 2x in Soketi
  2. I logged in with a user with ID of 10822 and executed a job which executed a notification on queue
  3. i then logged out and logged in with a user of ID 2
  4. I executed the same job which executed a notification.
  5. I see Soketi is still subscribed to the old user ID.....

Screenshot 2023-11-01 at 08 01 07

Expected behavior
Soketi should not have duplicates to client.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment

  • Soketi version (i.e. 1.3.0): quay.io/soketi/soketi:latest-16-alpine
  • Adapter (local, redis): local
  • 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:

2023-11-01 07:52:24    [Wed Nov 01 2023 05:52:24 GMT+0000 (Coordinated Universal Time)]  New message received:   
2023-11-01 07:52:24 { message: { event: 'pusher:ping', data: {} }, isBinary: false }
2023-11-01 07:52:24    [Wed Nov 01 2023 05:52:24 GMT+0000 (Coordinated Universal Time)]  Sent message to client:   
2023-11-01 07:52:24 {
2023-11-01 07:52:24   ws: uWS.WebSocket {
2023-11-01 07:52:24     ip: '192.168.65.1',
2023-11-01 07:52:24     ip2: '',
2023-11-01 07:52:24     appKey: 'dealeros_local',
2023-11-01 07:52:24     sendJson: [Function (anonymous)],
2023-11-01 07:52:24     id: '8986147344.3469808005',
2023-11-01 07:52:24     subscribedChannels: Set(6) {
2023-11-01 07:52:24       'private-invoice-linked-2',
2023-11-01 07:52:24       'private-user-updated-2',
2023-11-01 07:52:24       'private-user.2',
2023-11-01 07:52:24       'private-invoice-linked-1625',
2023-11-01 07:52:24       'private-user-updated-10822',
2023-11-01 07:52:24       'private-user.10822'
2023-11-01 07:52:24     },
2023-11-01 07:52:24     presence: Map(0) {},
2023-11-01 07:52:24     app: App {
2023-11-01 07:52:24       initialApp: [Object],
2023-11-01 07:52:24       server: [Server],
2023-11-01 07:52:24       enableUserAuthentication: false,
2023-11-01 07:52:24       hasClientEventWebhooks: false,
2023-11-01 07:52:24       hasChannelOccupiedWebhooks: false,
2023-11-01 07:52:24       hasChannelVacatedWebhooks: false,
2023-11-01 07:52:24       hasMemberAddedWebhooks: false,
2023-11-01 07:52:24       hasMemberRemovedWebhooks: false,
2023-11-01 07:52:24       hasCacheMissedWebhooks: false,
2023-11-01 07:52:24       id: 'dealeros_0',
2023-11-01 07:52:24       key: 'dealeros_local',
2023-11-01 07:52:24       secret: 'TiAFjzlp2SSbWIB3oaftHiKlrmJZ52Pt',
2023-11-01 07:52:24       maxConnections: -1,
2023-11-01 07:52:24       enableClientMessages: false,
2023-11-01 07:52:24       enabled: true,
2023-11-01 07:52:24       maxClientEventsPerSecond: -1,
2023-11-01 07:52:24       maxPresenceMembersPerChannel: 100,
2023-11-01 07:52:24       maxPresenceMemberSizeInKb: 2,
2023-11-01 07:52:24       maxChannelNameLength: 200,
2023-11-01 07:52:24       maxEventChannelsAtOnce: 100,
2023-11-01 07:52:24       maxEventNameLength: 200,
2023-11-01 07:52:24       maxEventPayloadInKb: 100,
2023-11-01 07:52:24       maxEventBatchSize: 10
2023-11-01 07:52:24     },
2023-11-01 07:52:24     timeout: Timeout {
2023-11-01 07:52:24       _idleTimeout: 120000,
2023-11-01 07:52:24       _idlePrev: [TimersList],
2023-11-01 07:52:24       _idleNext: [TimersList],
2023-11-01 07:52:24       _idleStart: 398956,
2023-11-01 07:52:24       _onTimeout: [Function (anonymous)],
2023-11-01 07:52:24       _timerArgs: undefined,
2023-11-01 07:52:24       _repeat: null,
2023-11-01 07:52:24       _destroyed: false,
2023-11-01 07:52:24       [Symbol(refed)]: true,
2023-11-01 07:52:24       [Symbol(kHasPrimitive)]: false,
2023-11-01 07:52:24       [Symbol(asyncId)]: 910,
2023-11-01 07:52:24       [Symbol(triggerId)]: 0
2023-11-01 07:52:24     }
2023-11-01 07:52:24   },
2023-11-01 07:52:24   data: { event: 'pusher:pong', data: {} }
2023-11-01 07:52:24 }
2023-11-01 07:52:28    [Wed Nov 01 2023 05:52:28 GMT+0000 (Coordinated Universal Time)]  HTTP Payload received   
2023-11-01 07:52:28 {
2023-11-01 07:52:28   name: 'Illuminate\\Notifications\\Events\\BroadcastNotificationCreated',
2023-11-01 07:52:28   data: '{"title":"Your export is ready for download","link":"test","id":"6df59cff-babd-476d-82de-8cb2b469dd77","type":"export-ready"}',
2023-11-01 07:52:28   channel: 'private-user.2'
2023-11-01 07:52:28 }
2023-11-01 07:52:28    [Wed Nov 01 2023 05:52:28 GMT+0000 (Coordinated Universal Time)]  Sent message to client:   
2023-11-01 07:52:28 {
2023-11-01 07:52:28   ws: uWS.WebSocket {
2023-11-01 07:52:28     ip: '192.168.65.1',
2023-11-01 07:52:28     ip2: '',
2023-11-01 07:52:28     appKey: 'dealeros_local',
2023-11-01 07:52:28     sendJson: [Function (anonymous)],
2023-11-01 07:52:28     id: '8986147344.3469808005',
2023-11-01 07:52:28     subscribedChannels: Set(6) {
2023-11-01 07:52:28       'private-invoice-linked-2',
2023-11-01 07:52:28       'private-user-updated-2',
2023-11-01 07:52:28       'private-user.2',
2023-11-01 07:52:28       'private-invoice-linked-1625',
2023-11-01 07:52:28       'private-user-updated-10822',
2023-11-01 07:52:28       'private-user.10822'
2023-11-01 07:52:28     },
2023-11-01 07:52:28     presence: Map(0) {},
2023-11-01 07:52:28     app: App {
2023-11-01 07:52:28       initialApp: [Object],
2023-11-01 07:52:28       server: [Server],
2023-11-01 07:52:28       enableUserAuthentication: false,
2023-11-01 07:52:28       hasClientEventWebhooks: false,
2023-11-01 07:52:28       hasChannelOccupiedWebhooks: false,
2023-11-01 07:52:28       hasChannelVacatedWebhooks: false,
2023-11-01 07:52:28       hasMemberAddedWebhooks: false,
2023-11-01 07:52:28       hasMemberRemovedWebhooks: false,
2023-11-01 07:52:28       hasCacheMissedWebhooks: false,
2023-11-01 07:52:28       id: 'dealeros_0',
2023-11-01 07:52:28       key: 'dealeros_local',
2023-11-01 07:52:28       secret: 'TiAFjzlp2SSbWIB3oaftHiKlrmJZ52Pt',
2023-11-01 07:52:28       maxConnections: -1,
2023-11-01 07:52:28       enableClientMessages: false,
2023-11-01 07:52:28       enabled: true,
2023-11-01 07:52:28       maxClientEventsPerSecond: -1,
2023-11-01 07:52:28       maxPresenceMembersPerChannel: 100,
2023-11-01 07:52:28       maxPresenceMemberSizeInKb: 2,
2023-11-01 07:52:28       maxChannelNameLength: 200,
2023-11-01 07:52:28       maxEventChannelsAtOnce: 100,
2023-11-01 07:52:28       maxEventNameLength: 200,
2023-11-01 07:52:28       maxEventPayloadInKb: 100,
2023-11-01 07:52:28       maxEventBatchSize: 10
2023-11-01 07:52:28     },
2023-11-01 07:52:28     timeout: Timeout {
2023-11-01 07:52:28       _idleTimeout: 120000,
2023-11-01 07:52:28       _idlePrev: [TimersList],
2023-11-01 07:52:28       _idleNext: [TimersList],
2023-11-01 07:52:28       _idleStart: 402357,
2023-11-01 07:52:28       _onTimeout: [Function (anonymous)],
2023-11-01 07:52:28       _timerArgs: undefined,
2023-11-01 07:52:28       _repeat: null,
2023-11-01 07:52:28       _destroyed: false,
2023-11-01 07:52:28       [Symbol(refed)]: true,
2023-11-01 07:52:28       [Symbol(kHasPrimitive)]: false,
2023-11-01 07:52:28       [Symbol(asyncId)]: 918,
2023-11-01 07:52:28       [Symbol(triggerId)]: 0
2023-11-01 07:52:28     }
2023-11-01 07:52:28   },
2023-11-01 07:52:28   data: {
2023-11-01 07:52:28     event: 'Illuminate\\Notifications\\Events\\BroadcastNotificationCreated',
2023-11-01 07:52:28     channel: 'private-user.2',
2023-11-01 07:52:28     data: '{"title":"Your export is ready for download","link":"test","id":"6df59cff-babd-476d-82de-8cb2b469dd77","type":"export-ready"}'
2023-11-01 07:52:28   }
2023-11-01 07:52:28 }
2023-11-01 07:52:59    [Wed Nov 01 2023 05:52:59 GMT+0000 (Coordinated Universal Time)]  New message received:   
2023-11-01 07:52:59 { message: { event: 'pusher:ping', data: {} }, isBinary: false }

Additional context
Add any other context about the problem here.

@jackkitley jackkitley added the status:triage Awaiting triage. label Nov 1, 2023
Copy link

codeautopilot bot commented Nov 1, 2023

Disclaimer: This comment was entirely generated using AI. Be aware that the information provided may be incorrect.

Your organization has reached the subscribed usage limit. Cannot process the task. You can upgrade your plan at https://www.codeautopilot.com/#pricing


Current plan usage: 159.51%


Have feedback or need help?

Discord
Documentation
support@codeautopilot.com

@jackkitley
Copy link
Author

This turned out to be an oversubscribed problem with Laravel Echo. I needed to execute leave channel command to prevent duplicate joining.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:triage Awaiting triage.
Development

No branches or pull requests

2 participants