How does workerman specify that users send messages?

how can workerman, like gatewayworker, bind uid and client_id together to send messages to designated users, online, etc., and beg for help from bosses, so that good people can live a safe life!

Jun.25,2021

http://doc.workerman.net/faq/.
, is this what you need?


gatewayworker framework native support, wokerman itself does not support, this needs to be implemented by yourself, the general principle is:

  1. create a mapping table: specifically used to store the mapping between uid and client_id.
  2. about the mapping relationship between uid and client_id: you can either one-to-many or force one-to-one.
  3. the mapping relationship is written every time you log in, and the corresponding mapping record is deleted according to client_id each time you exit.
  4. encapsulates an interface similar to Gateway::sendToUid ($uid, $message): look up $client_id based on $uid
  5. finally call Gateway::sendToClient ($client_id, $message) to send.
Menu