supabase-community / realtime-csharp

A C# client library for supabase/realtime.
https://supabase-community.github.io/realtime-csharp/api/Supabase.Realtime.Client.html
MIT License
70 stars 12 forks source link

Presence fails when signed in #43

Closed kuffs closed 7 months ago

kuffs commented 7 months ago

Bug report

Describe the bug

I'm not sure when this started as I only know about it because a customer reported something not working. With trial and error, I narrowed it down to the title issue.

Presence seems to work fine so long as I do not sign in. However, Once signed in , it continuously fails with "unmatched topic" errors like:

{"event":"phx_reply","payload":{"response":{"reason":"unmatched topic"},"status":"error"},"ref":"cbc3f989-d151-4061-8731-4e3812a46a8a","topic":"realtime:11111111111111111111111111111112"}

To Reproduce

Test project here. https://github.com/kuffs/WinFormsApp1

Press "Connect". Failure messages occur Stop App

Comment out the SignIn Press "Connect". Works normally

Expected behavior

No errors even when signed in

System information

Additional context

Example output when NOT signed in

Socket Push [topic: phoenix, event: heartbeat, ref: 249da0aa-4afb-4b92-9e55-4b34781c8784]:
    {}
Socket Push [topic: realtime:11111111111111111111111111111112, event: phx_join, ref: 236193f1-3061-4a38-ab53-f58abac63927]:
    {
  "config": {
    "broadcast": {
      "self": false,
      "ack": false
    },
    "presence": {
      "key": "67e7c61e-de76-4f6f-8d4a-b35065828ef4"
    },
    "postgres_changes": []
  }
}
Socket Message Received:
    {"event":"phx_reply","payload":{"response":{},"status":"ok"},"ref":"249da0aa-4afb-4b92-9e55-4b34781c8784","topic":"phoenix"}
Socket Message Received:
    {"event":"phx_reply","payload":{"response":{"postgres_changes":[]},"status":"ok"},"ref":"236193f1-3061-4a38-ab53-f58abac63927","topic":"realtime:11111111111111111111111111111112"}
Socket Message Received:
    {"event":"presence_state","payload":{},"ref":null,"topic":"realtime:11111111111111111111111111111112"}
Socket Push [topic: realtime:11111111111111111111111111111112, event: presence, ref: b47f2f37-3f6f-4eb0-a4be-bb4fc58d77a7]:
    {
  "event": "track",
  "payload": {
    "lastSeen": "2024-04-19T10:58:19.1179627+01:00"
  }
}
Socket Message Received:
    {"event":"phx_reply","payload":{"response":{},"status":"ok"},"ref":"b47f2f37-3f6f-4eb0-a4be-bb4fc58d77a7","topic":"realtime:11111111111111111111111111111112"}
Socket Message Received:
    {"event":"presence_diff","payload":{"joins":{"67e7c61e-de76-4f6f-8d4a-b35065828ef4":{"metas":[{"phx_ref":"F8emAN1olJJf2g5K","lastSeen":"2024-04-19T10:58:19.1179627+01:00"}]}},"leaves":{}},"ref":null,"topic":"realtime:11111111111111111111111111111112"}
SYNC: 67e7c61e-de76-4f6f-8d4a-b35065828ef4 - 19 April 2024 10:58:19
JOIN: 67e7c61e-de76-4f6f-8d4a-b35065828ef4 - 19 April 2024 10:58:19

Example output when signed in

Socket Push [topic: realtime:11111111111111111111111111111112, event: phx_join, ref: d3c7f23b-e099-4912-9547-c54c423b51ff]:
{
  "config": {
    "broadcast": {
      "self": false,
      "ack": false
    },
    "presence": {
      "key": "fa8ca6fc-c019-44e6-a5ab-b83db02117b8"
    },
    "postgres_changes": []
  }
}
Socket Message Received:
    {"event":"phx_reply","payload":{"response":{"postgres_changes":[]},"status":"ok"},"ref":"d3c7f23b-e099-4912-9547-c54c423b51ff","topic":"realtime:11111111111111111111111111111112"}
Socket Push [topic: realtime:11111111111111111111111111111112, event: access_token, ref: ef841bf3-e515-4af9-ace2-82ed9a905dab]:
    {
  "access_token": "REDACTED"
}
Socket Message Received:
    {"event":"presence_state","payload":{},"ref":null,"topic":"realtime:11111111111111111111111111111112"}
Socket Push [topic: realtime:11111111111111111111111111111112, event: presence, ref: cbc3f989-d151-4061-8731-4e3812a46a8a]:
    {
  "event": "track",
  "payload": {
    "lastSeen": "2024-04-19T10:57:49.2670699+01:00"
  }
}
Socket Message Received:
    {"event":"phx_error","payload":{},"ref":"d3c7f23b-e099-4912-9547-c54c423b51ff","topic":"realtime:11111111111111111111111111111112"}
Socket Message Received:
    {"event":"phx_reply","payload":{"response":{"reason":"unmatched topic"},"status":"error"},"ref":"cbc3f989-d151-4061-8731-4e3812a46a8a","topic":"realtime:11111111111111111111111111111112"}
kuffs commented 7 months ago

Seems to have started working again. Possibly back end issue that's now resolved?

acupofjose commented 7 months ago

Very odd. I'll admit I was struggling to reduplicate on my end, but I was still in the process of replicating it on my source codebase. Please let me know if it continues to be an issue!

acupofjose commented 7 months ago

Ref #44

kuffs commented 7 months ago

Will do. Thank you.