Real-time push update to only one user (not channel) at a time. How to do that?

后端 未结 1 453
情话喂你
情话喂你 2021-01-05 05:53

I\'m creating a web app/site in which my server will push real-time update to clients some info (using Pusher api).

So, the USERS that subscribe to a CHANNEL can rec

1条回答
  •  抹茶落季
    2021-01-05 06:20

    At the moment there is not way to send a message to a user other than to have a channel per user.

    My current solution is: Each CHANNEL allows only one USER so the update targeted to the CHANNEL is for that one USER. Suppose I have 500 users then I need to have 500 channels. This requires setting up a lot of channels. Does that affect performance?

    This sounds exactly like the solution you are using right now e.g. the channel - and user - can be uniquely identified by channel name:

    -notification

    Since channels are simply a routing mechanism there is no real overhead in having lots of channels; certainly 500 won't be any problem at all.

    I'm assuming you are using private channels to ensure that only the allowed user can subscribe to their channel.

    0 讨论(0)
提交回复
热议问题