Home >Backend Development >PHP Tutorial >How to build a point-to-point chat function with swoole+websocket
If the customer service staff is logged in, it will be displayed on the page that the customer service is online. After the customer logs in, they can choose a customer service for consultation
No matter customer service or users, they can be reconnected and matched by refreshing the page.
I’m new to swoole and I’m not familiar with it. My first instinct is to find a way to save the current ws connection id and user_id to redis when logging in. Rebind this relationship when refreshing the page. When sending a message, bring the corresponding user_id to the background. Find the connection ID and send the information! !
I don’t know if this is reasonable or not. I don’t have a deep understanding of it yet. Please give me some guidance. Thank you very much!
If the customer service staff is logged in, it will be displayed on the page that the customer service is online. After the customer logs in, they can choose a customer service for consultation
No matter customer service or users, they can be reconnected and matched by refreshing the page.
I am new to swoole and I am not familiar with it. My first instinct is to find a way to save the current ws connection id and user_id to redis when logging in. When refreshing the page, rebind this relationship. When sending a message, bring the corresponding user_id to the background. Find the connection ID and send the information! !
I don’t know if this is reasonable or not. I don’t have a deep understanding of it yet. Please give me some guidance. Thank you very much!