How to build a point-to-point chat function using swoole + websocket

Source: Internet
Author: User
If the customer service personnel log in, the customer service is displayed online on the page. after the customer logs in, you can choose a customer service consulting service, regardless of the customer service, user, and refresh page, to reconnect and match. I am not familiar with swoole. My first instinct is to find a way to connect the current ws when logging on... if the customer service personnel logs in, the customer service is displayed online on the page. after the customer logs in, you can select a customer service for consultation.

Regardless of customer service, user, and refresh page, you can reconnect and match.

I am not familiar with swoole. My first instinct is to find a way to save the current ws Connection id and user_id to redis during login, rebind the link when refreshing the page, and send the information, take the corresponding user_id and find the connection id in the background to send the information !!

I don't know why it is unreasonable to do this. I don't have any in-depth understanding yet. I am very grateful to you for your guidance!

Reply content:

If the customer service personnel logs in, the customer service is displayed online on the page. after the customer logs in, you can select a customer service for consultation.

Regardless of customer service, user, and refresh page, you can reconnect and match.

I am not familiar with swoole. My first instinct is to find a way to save the current ws Connection id and user_id to redis during login, rebind the link when refreshing the page, and send the information, take the corresponding user_id and find the connection id in the background to send the information !!

I don't know why it is unreasonable to do this. I don't have any in-depth understanding yet. I am very grateful to you for your guidance!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.