Socket refresh heads-up


Might be obvious to most, but I made the mistake of using “Refresh Server Action” for everything, which caused big performance issues. When developing, it’s all fine as you’re the only one testing the app, but when I started to have more users I noticed the problem.

Screenshot 2022-06-23 at 16.17.24

When I wanted to refresh data for 1 user, and I used “Refresh Server Action”, it was obviously refreshing ALL user’s api’s, which basically froze the app for everyone.

So when a refresh is needed:

Use Emit for a group of users that you want to target (for example if all users within a company need an update):

  • In my case when a user connects, it connects to the room of his company id
    Screenshot 2022-06-23 at 16.37.34

So when I want to refresh all users from 1 specific company, I emit to the company room:

Use Direct Message to target just one user

  • When a user connects to the app, I update a database table with the user’s socket id, which I look up when needed and send a direct message to only his socket id

Then in the front-end, you can use the socket component to handle the socket messages for the specific socket events, and run the database refreshes:

So again, probably obvious, but I wanted to spare you the time of re-doing all this like me in case you just got started with developing with only the “Refresh server action” :sweat_smile:


You can find info about emit, broadcast and direct messages here:


I remember having that Aha moment as well. :rofl:


Hi, I would really appreciate your help here guys.

I really trying to get this works.
How to config the Join and where?
When the connect and disconnect are execute?

For example, how to update a API just like Refresh Server Action only to a specific group like same busines_id?

In the Frontend, how to update the API when the “emit” send to the update order. In Refresh Server Action we only enabled in Dynamic Attributes the Live Refresh with Socket. How to get similar behiviour using , join, emit and etc…

The same of other Sockets module like, Leave Room, Get Joined Rooms and Get All Rooms, how they works and how to use them to don’t fall into the performance issue by the Refresh Server Action.

Sorry @teodor but this guide really doesn’t help if most used option is Refresh Server Action and there are not clearly way to replace it with join, emit, etc…