Is lightweight an POST or an Channel Push

Well, i think is a noob question but i already asked my self this a lot of times.

If i have an screen with a lot of interactions with Database(via JS)…is a good practice i setup an channel just for this user based on his id ? Or some uuid, anyway, an channel of 1 user.

The question is, worth do this ? In terms of performance ? because i will have an Channel running for each user. Or is preferable to do some traditional POST requests ?

If someone want to share his experience in this will be good, thanks.

I don’t quite understand the question, but I’m going to tell you rule of thumb then try to answer.

But my rule of thumb is, “If I need to push data to the client that is out of the normal request cycle, then use a WebSocket. Otherwise, a POST is probably ok.”

Now it sounds like you’re asking, “My clients are going to connect to different channels and I don’t know if there is an overhead to creating so many ‘channels’.” If that’s what you’re asking then the overhead would be literally be the same as keeping a registry that maps a user to a pid. Which is to say the overhead is minimal.

1 Like