Sockets, when to use socket actions?

Confused about the socket integration

There are 2 different things we can do as far as I understand.

1: Create actions under Sockets image
This seems to be used by the newer tutorials in march like API Action Realtime Progress with WebSockets WebSockets - Realtime Messaging

  1. Use socket actions inside a step in an API action
    and then use refresh server action (but now also we can use ‘emit’ ‘direct message’ and ‘get all rooms’ in there.
    This is used in the first tutorial when it was initially released Realtime Data Update with NodeJS and WebSockets

When do we use what?

1 Like

Thanks Teodor I’ve been looking at all your threads for some time now :wink:

Please advice:

  1. I have 2 tables: schools and schools_notifications
    image
  2. I want to send a notification (news message) within a specific school, so I insert a new record in schools_notifications
  3. I want everyone on the page of that specific school to get the red circle on their notifications icon image once I add the notification

Do I use the same logic from this thread WebSockets - Realtime Messaging or from this thread: Realtime Data Update with NodeJS and WebSockets

(the last thread does what I want but that was before the full integration of sockets, I don’t need to send a message to ALL clients. Only the clients that are on a certain school, so on a school.mywebsite.com subdomain.)