supabase-community / realtime-go

1 stars 3 forks source link

Server Event Income Handling #2

Open muratmirgun opened 10 months ago

muratmirgun commented 10 months ago

Handle necessary events coming from the server and update the channel according to the event.

We can discuss from issue about the Events

IcedTea2K commented 3 months ago

Hey Murat 😄 are there any documentations on all the possible event messages? There is a pretty extensive list over the js side (link), but not sure if that's everything or what they all mean.

Edit: nvm, found the documentation on phoenix framework, which is used to build the realtime server.

IcedTea2K commented 3 months ago

Hey @muratmirgun, here are a couple of design decisions that we could make. Currently, realtime-js allows you to create two channels of the same name, using the same real-time client. Should we:

  1. Allow the same. But probably need to document this somewhere because realtime-js is lacking in that aspect
  2. Disallow that by having a check, and throw an error
  3. Don't overwrite the channel. Instead, update the channel to listen to newly specified events. (But then the question arises, do we update the channel at On or at Subscribe?)

Personally, I like second option the most, because it's easiest to implement and it'll probably save developers from having to debug where the heck their events went. Though, I'm not too sure how much we can deviate from realtime-js behaviour.

muratmirgun commented 3 months ago

We can choose the second method for now if somethings goes wrong we can change it later