CN111106996B - WebSocket and cache-based multi-terminal online chat system - Google Patents

WebSocket and cache-based multi-terminal online chat system Download PDF

Info

Publication number
CN111106996B
CN111106996B CN201911384141.7A CN201911384141A CN111106996B CN 111106996 B CN111106996 B CN 111106996B CN 201911384141 A CN201911384141 A CN 201911384141A CN 111106996 B CN111106996 B CN 111106996B
Authority
CN
China
Prior art keywords
chat
module
websocket
cache
customer
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201911384141.7A
Other languages
Chinese (zh)
Other versions
CN111106996A (en
Inventor
顾传龙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Anhui Weiwo Information Technology Co ltd
Original Assignee
Anhui Weiwo Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Anhui Weiwo Information Technology Co ltd filed Critical Anhui Weiwo Information Technology Co ltd
Priority to CN201911384141.7A priority Critical patent/CN111106996B/en
Publication of CN111106996A publication Critical patent/CN111106996A/en
Application granted granted Critical
Publication of CN111106996B publication Critical patent/CN111106996B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/04Real-time or near real-time messaging, e.g. instant messaging [IM]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/04Real-time or near real-time messaging, e.g. instant messaging [IM]
    • H04L51/046Interoperability with other network applications or services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/07User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail characterised by the inclusion of specific contents
    • H04L51/10Multimedia information
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/07User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail characterised by the inclusion of specific contents
    • H04L51/18Commands or executable codes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/21Monitoring or handling of messages
    • H04L51/216Handling conversation history, e.g. grouping of messages in sessions or threads
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • H04L69/161Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields
    • H04L69/162Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields involving adaptations of sockets based mechanisms

Abstract

A multi-terminal online chatting system based on WebSocket and cache can solve the technical problems of poor timeliness and poor instant interactivity of the existing online communication tool. Computer-based device, comprising the following modules: the chat window front-end self-adaptive client page module is based on a WebSocket and a cached server; the server based on the WebSocket and the cache is further divided into: the system comprises a message record cache processing module, an automatic multi-chat room allocation module, a file picture voice processing module, a message entity module and a multithreading safety processing module; the invention can keep long connection, realizes two-way real-time communication between the browser and the server, and has good instant interactivity; the problem of multi-terminal online communication is solved, and the problem of multi-thread concurrence is solved; the method supports multiple chat rooms, realizes load balance of multiple customer services, and solves the problem of high-concurrency user consultation; supporting the number of unread message reminders; the system is modularized and lightweight, and can become an independent distributed system to provide services for the outside.

Description

WebSocket and cache-based multi-terminal online chat system
Technical Field
The invention relates to the technical field of computers, in particular to a multi-terminal online chat system based on WebSocket and cache.
Background
At present, chat modules are often required to be integrated in various electronic commerce websites, particularly in electronic commerce websites of foreign trade industries, most electronic commerce websites on the market at present are not integrated with real-time chat tools, and even if integration is carried out, independent chat software of a third party is used or communication is carried out in a mail mode, so that instant interactivity is poor, customers select commodities and purchase the commodities are inconvenient, for example, the customers cannot know parameters such as performance, size and color of the commodities in real time;
in the enterprise management application system, there is always a need for the system to push system messages, such as system upgrade bulletin, task allocation notification, online and offline reminding, personal prompting information, etc., to all users.
Some tools for solving the problems appear in the market at present, but the online communication tools of the e-commerce website or the enterprise management system which are popular in the market at present have the following problems:
(1) the communication operation is generally performed only based on the mode of sending the mail;
(2) the phenomenon of message blocking exists, the real-time performance is poor, and the instant interactivity is poor;
(3) do not support multiple chat rooms;
(4) unread offline message alerts are not supported;
(5) the system is not modularized, is of a heavy weight grade and cannot be changed into an independent distributed system;
(6) it does not support sending emoji expressions, nor files.
Disclosure of Invention
The multi-terminal online chatting system based on the WebSocket and the cache can solve the technical problems of poor timeliness and poor instant interactivity of the existing online communication tool.
In order to achieve the purpose, the invention adopts the following technical scheme:
a multi-terminal online chat system based on WebSocket and cache is based on computer equipment and comprises the following modules:
the chat window front-end self-adaptive client page module is based on a WebSocket and a cached server;
the server based on the WebSocket and the cache is further divided into: the system comprises a message record cache processing module, an automatic multi-chat room allocation module, a file picture voice processing module, a message entity module and a multithreading safety processing module;
the chat window front-end self-adaptive client page module is used for realizing the following steps:
(1) the method comprises the steps of realizing the display of a chat window on a front-end page, wherein two role display windows are respectively a customer service role and a user role, automatically displaying the chat window of the customer service when the customer service logs in, and automatically displaying the chat window of a client when the client logs in;
(2) the method comprises the steps of realizing the self-adaptive adjustment of the size of a chat window, realizing the automatic adjustment of the window through a window.
(3) The method realizes webSocket programming in a self-adaptive client page module at the front end of a chat window, keeps long connection with a server, and when a server transmits a message, the two conditions are divided into two conditions:
(3.1) the receiver is in an online state, namely the webSocket object of the front-end page module receives the information of the server side, and the webSocket object dynamically displays the received information to the front-end page;
(3.2) the receiver is in an off-line state, namely the front-end page module does not process the off-line unread messages, and when the receiver logs in next time, the front-end page module takes out all the off-line unread messages and dynamically displays the off-line unread messages to the front-end page;
(4) the method is used for realizing self-adaption of a client page at the front end of a chat window under the condition of multiple chat rooms;
the WebSocket and cache-based server can realize the following steps:
a message entity module: the entity class is used for defining the message, and necessary field attributes of message data are encapsulated;
message record buffer memory processing module: the message record caching module is used for storing all chat records to the message record caching processing module, and all the chat history records can be stored to the caching module no matter whether the user is in an online state or an offline state;
the automatic multi-chat-room distribution module comprises: the system administrator manually and dynamically allocates a plurality of customer services in the background, each customer service is a group owner of a chat room after logging in, a hash value of each customer service is calculated according to the unique identity of the customer after logging in, the customer service is automatically allocated to a corresponding chat room according to the hash value, the allocated chat room is called as a default chat room, and the customer can chat with the group owner of the corresponding chat room;
a multithreading safety processing module: the method is used for realizing the safety of multithreading, and the critical resource common to a plurality of users is a thread safety strategy to ensure the thread safety of the users;
and the file picture voice processing module is used for supporting voice, pictures and files sent between the client and the customer service to be uploaded to the server in a binary stream mode, and after the voice, the pictures and the files are uploaded, the file picture voice processing module returns the stored path address and stores the address into a cache.
Further, for the case of multiple chat rooms, the adaptive client page module at the front end of the chat window comprises the following steps:
the system background is dynamically distributed with a plurality of customer services, each customer service role is the group owner of the corresponding chat room in the front-end page chat window, when a customer logs in, the system automatically distributes the customer service roles to the corresponding chat rooms according to the hash value represented by the login user to realize load balance, and the front-end page module displays the chat history records of the customer and the customer service in the chat room where the customer is located.
Further, the thread safety method of the multithread safety processing module comprises the following steps: self-defining local thread variables, or using a read security lock and a write security lock syncronized, or using a ConcurrentHashMap thread Security Map under a java.
According to the technical scheme, the multi-terminal online chatting system based on the WebSocket and the cache has the following beneficial effects:
(1) the long connection is kept, the two-way real-time communication between the browser and the server is realized, and the instant interactivity is good.
(2) The method solves the problem of multi-terminal online communication and the problem of multi-thread concurrence.
(3) Support multiple chat rooms, realize load balance of multiple customer services, and solve the problem of high-concurrency user consultation
(4) The number of unread message reminders is supported.
(5) The modularized and lightweight system can become an independent distributed system and provide services for the outside.
(6) Chat window adaptation.
(7) Chat rooms are automatically assigned according to the hash value, i.e. to customer services.
(8) The user clicks website introduction, commodity details and the like in the chatting information, the customer service automatically replies, self-service intelligent reply management is realized, and the customer service pressure is reduced.
(9) And sending expressions, pictures, screenshots, files and the like is supported.
(10) An offline unread message is received. After receiving, the unread state of the message is erased.
Drawings
FIG. 1 is a block diagram of the present invention;
FIG. 2 is a schematic view of a chat message streaming process of the present invention;
FIG. 3 is a schematic diagram of the workflow of webSocket message sending and receiving according to the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention.
As shown in fig. 1, the multi-terminal online chat system based on WebSocket and cache according to this embodiment includes:
the system comprises a chat window front-end self-adaptive client page module and a server based on WebSocket and cache, wherein the server based on WebSocket and cache is further divided into a message recording cache processing module, a multi-chat-room automatic allocation module, a file picture voice processing module, a message entity module and a multithreading safety processing module.
The chat window front-end self-adaptive client page module has the working principle as follows:
(1) the chat window is displayed on a front-end page, two role display windows are provided, namely a customer service role and a user role, the chat window of the customer service is automatically displayed when the customer service logs in, and the chat window of the customer is automatically displayed when the customer logs in.
(2) The size of the chat window is adjusted in a self-adaptive mode, the window is adjusted automatically mainly through a window. And the minimization and the expansion of the chat window can be supported, and the method is very convenient.
(3) In a chat window front-end self-adaptive client page module, performing webSocket programming, keeping long connection with a server, and when a server transmits a message, dividing into two situations:
and (3.1) the receiver is in an online state, namely the webSocket object of the front-end page module receives the information of the server side, and the webSocket object dynamically displays the received information to the front-end page.
(3.2) the receiver is in an off-line state, namely the front-end page module does not process the off-line unread messages, and when the receiver logs in next time, the front-end page module takes out all the off-line unread messages and dynamically displays the off-line unread messages to the front-end page;
(4) for the situation of multiple chat rooms, the technical scheme in the front-end adaptive client page module of the chat window is that a plurality of customer services are dynamically distributed in a system background, each customer service role is a group owner of a corresponding chat room in the front-end page chat window, when a customer logs in, the system automatically distributes the customer into the corresponding chat room according to a hash value represented by a login user to realize load balance, and the front-end page module displays the chat history of the customer and the customer service in the chat room where the customer is located.
The operation principle of the WebSocket and cache-based server is as follows:
(1) the message entity module is used for defining the entity class of the message and packaging necessary field attributes of some message data, such as a sender, a receiver, information content, a file address, sending time, unread state and the like, so that the data can be conveniently operated by the module.
(2) And the message record caching processing module is used for storing all the chat records into the message record caching processing module, and all the chat history records are stored into the caching module no matter the user is in an online state or an offline state. Every time each user logs in, the data of the chat history record related to the user is inquired from the cache, and the chat record can be displayed back at the front end.
(3) The system administrator manually and dynamically allocates a plurality of customer services in the background, each customer service is a group owner of the corresponding chat room after logging in, the hash value of the customer is calculated according to the unique identity (which can be according to the unique identity of an ip address, a customer mailbox and the like) of the customer after logging in, the customer is automatically allocated to the corresponding chat room according to the hash value, the allocated chat room is called as a default chat room, and the customer can chat with the group owner (namely the customer service) of the corresponding chat room. Therefore, the pressure of customer service can be reduced, the pressure of server threads can be reduced, and the load balance of the customer service is realized.
(4) The multithreading safety processing module is designed to realize multithreading safety, thread safety is guaranteed by a thread safety strategy for a critical resource common to a plurality of users, and the thread safety strategy has various realization schemes, such as self-defining local thread variables, or using a read safety lock and a write safety lock synchronized, or using a ConcurrentHashMap thread safety Map under the package of java.util.current.current;
(5) the file picture voice processing module supports the client and the customer service to send voices, pictures, files, characters and the like, has diversified communication modes, and improves the user experience. The transmitted voice, picture and file are uploaded to the server in a binary stream mode through the file picture voice processing module, and after the voice, picture and file are uploaded, the file picture voice processing module returns the stored path address and stores the address in the cache.
The following is a detailed description:
(1) chat window front end self-adaptation client page module:
the method comprises the steps that JavaScript programming of WebSocket is conducted in a front-end self-adaptive client page of a chat window, after a client and a customer service log in a website, a browser immediately sends a request of a ws protocol to a background server based on WebSocket and cache to establish ws-long connection, and therefore real-time communication can be conducted between the browser and a server through WebSocket.
When the webSocket connection is successful, execution of a webSocket.
When a user (including customer service and a client) inputs characters, voice, pictures, files and the like in a front-end self-adaptive client page of a chat window and clicks a 'send' button, a WebSocket send () method is called through javaScript control, a message is sent to a server based on Websocket and cache, and after the server receives the message, an onMessage () method of the server is automatically executed.
When a current login user is online and a self-adaptive client page at the front end of a chat window receives a message, the method of websocket. And displaying the received message in a front-end chat window by a javaScript method.
When a receiver is in an offline state, the front page of the chat window does not do any operation, all offline unread messages of the receiver are stored in a redis cache in a WebSocket and cache-based server, then, when the receiver logs in next time, an ajax request is called, all chat history records including read messages and offline unread messages are loaded from the redis cache, and then data are rendered to the front page of the chat window.
(2) The server based on WebSocket and cache comprises the following components:
and (2.1) an entity model module, which comprises a message entity model and a response object model. For encapsulating data, calling data, and returning data.
And (2.2) the WebSocket is connected with the service interface and the implementation class thereof.
After the client and the customer service log in the website, the WebSocket connection service interface receives a ws protocol request sent by the front-end browser and establishes ws-long connection, so that real-time communication can be carried out between the browser and the server through the WebSocket.
And when the webSocket is successfully connected, triggering and executing an onOpen () method, calculating the current login number by using a counter, and storing sessions of all online users by using a multithread safe ConcurrentHashMap.
The webSocket is invoked when a user (including customer service and client) sends a message in a chat window, clicking the "send" button. And after receiving the message, the WebSocket connection service interface automatically executes an onMessage () method, acquires the session of the receiver through a multithread secure ConcurrentHashMap, does not send the message if the session of the receiver cannot be acquired, stores the message into a redis cache database, and if the session of the receiver can be acquired, indicates that the receiver is online, stores the message into the redis cache database, and then calls the session. getbiasicremote (). The sendText () method sends a message to the browser, and the web socket is automatically executed when the front page of the chat window receives the message. An onmessage () method. And displaying the received message in a front-end chat window by a javaScript method.
And (2.3) logging in a service interface for loading data and an implementation class thereof by a user.
When a user (including customer service and a client) logs in next time, a front-end page calls an ajax request to obtain a chat history record from a redis cache database, firstly all one-way messages sent by all users to the current login user are obtained through first cycle traversal, messages sent by other users by the current login user are obtained through second traversal, all the messages are combined to form a Map < String, List < Message > set, and the two-way chat record of the current login user and all the other users is obtained. And finally, sequencing each group of chat history records according to sending time to obtain ordered chat records, and rendering the data to a front-end chat window.
(2.4) automatic Allocation Module for multiple chat rooms
A system administrator manually and dynamically allocates a plurality of customer services in the background, each customer service is a group owner of a respective chat room after logging in, a hash value of a customer is calculated according to the unique identity of the customer (which can be according to the unique identity of an ip address, a customer mailbox and the like), the customer is automatically allocated to the corresponding chat room according to the hash value, the allocated chat room is called as a default chat room, and the customer can chat with the group owner (namely the customer service) of the corresponding chat room. Therefore, the pressure of customer service can be reduced, the pressure of server threads can be reduced, and the load balance of the customer service is realized.
(2.5) a multithreading security processing module:
the module ensures the multithreading safety by self-defining local thread variables, realizing the multithreading safety of shared data by ConcurrentHashMap with multithreading safety and adopting a read safety lock and a write safety lock when necessary.
(2.6) a file picture voice processing module:
the module integrates a method for uploading files, pictures and voices, uploads data to a server hard disk file by using modes of binary stream, file stream and the like, persists the files, the pictures and the voices, and can be expanded into an hdfs distributed file system if the data volume of the file is large in a large website. After uploading, the file image voice processing module returns the stored path address and stores the address into the cache.
(2.7) the message record caching processing module:
the module integrates the commonly used increasing, deleting, modifying and checking method of the redis cache database, is convenient for other modules to call the commonly used increasing, deleting, modifying and checking method of the redis cache, and is convenient for development and management.
(3) Because the high efficiency of the redis cache database is excellent and is a good cache database, the redis cache database is adopted in the embodiment as a storage medium of chat message data, all chat history records are ensured not to be lost, even if the redis has an automatic eviction strategy, the redis automatic eviction strategy uses a default LRU algorithm, the eviction strategy is chat records which are not used for a long time, and the memory of the redis is expanded by using redis fragments and clusters, so that the problem can be solved.
In summary, the embodiments of the present invention have the following features:
(1) the front-end chat window page uses Websocket to realize the purpose of sending messages to the background server and can also receive messages from the server.
(2) The front-end chat window page can realize a self-adaptive window and improve the user experience
(3) And the server based on the Websocket and the cache realizes the reception of the message sent by the front end through the Websocket technology and sends the message to the receiver. And realizing the multi-terminal online real-time chat function.
(4) Through the multi-chat-room automatic allocation module, after a client logs in, the client is automatically allocated to a default chat room to realize customer service load balancing, the hash value of the client is calculated according to the unique identity of the client (the unique identity can be according to an ip address, a client mailbox and the like), the client is automatically allocated to the corresponding chat room according to the hash value, the allocated chat room is called as the default chat room, and the client can chat with a corresponding chat-room group owner (namely customer service). Therefore, the pressure of customer service can be reduced, the pressure of server threads can be reduced, and the load balance of the customer service is realized.
(5) The security problem of multithreading of data is solved through the encapsulated multithreading security processing module, a user-defined local thread variable is used, or a read security lock and a write security lock are used, and a ConcurrentHashMap thread security Map is used for realizing the security problem, so that disorder of data caused by high concurrency is avoided.
(6) The voice, the pictures, the files and the like are transmitted among users through the packaged file picture voice processing module, and the module uploads the voice, the pictures and the files to a hard disk of a server in a binary stream and file stream mode to realize the persistence of the files.
(7) And all message data are stored in a redis cache through the encapsulated message record cache processing module, so that all chat history records are ensured not to be lost.
The above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (2)

1. A multi-terminal online chat system based on WebSocket and cache is characterized in that: computer-based device, comprising the following modules:
the chat window front-end self-adaptive client page module is based on a WebSocket and a cached server;
the server based on the WebSocket and the cache is further divided into: the system comprises a message record cache processing module, an automatic multi-chat room allocation module, a file picture voice processing module, a message entity module and a multithreading safety processing module;
the chat window front-end self-adaptive client page module is used for realizing the following steps:
(1) the method comprises the steps of realizing the display of a chat window on a front-end page, wherein two role display windows are respectively a customer service role and a user role, automatically displaying the chat window of the customer service when the customer service logs in, and automatically displaying the chat window of a client when the client logs in;
(2) the method comprises the steps of realizing the self-adaptive adjustment of the size of a chat window, realizing the automatic adjustment of the window through a window.
(3) The method realizes webSocket programming in a self-adaptive client page module at the front end of a chat window, keeps long connection with a server, and when a server transmits a message, the two conditions are divided into two conditions:
(3.1) the receiver is in an online state, namely the webSocket object of the front-end page module receives the information of the server side, and the webSocket object dynamically displays the received information to the front-end page;
(3.2) the receiver is in an off-line state, namely the front-end page module does not process the off-line unread messages, and when the receiver logs in next time, the front-end page module takes out all the off-line unread messages and dynamically displays the off-line unread messages to the front-end page;
(4) the method is used for realizing self-adaption of a client page at the front end of a chat window under the condition of multiple chat rooms;
the WebSocket and cache-based server can realize the following steps:
a message entity module: the entity class is used for defining the message, and necessary field attributes of message data are encapsulated;
message record buffer memory processing module: the message record caching module is used for storing all chat records to the message record caching processing module, and all the chat history records can be stored to the caching module no matter whether the user is in an online state or an offline state;
the automatic multi-chat-room distribution module comprises: the system administrator manually and dynamically allocates a plurality of customer services in the background, each customer service is a group owner of a chat room after logging in, a hash value of each customer service is calculated according to the unique identity of the customer after logging in, the customer service is automatically allocated to a corresponding chat room according to the hash value, the allocated chat room is called as a default chat room, and the customer can chat with the group owner of the corresponding chat room;
a multithreading safety processing module: the method is used for realizing the safety of multithreading, and the critical resource common to a plurality of users is a thread safety strategy to ensure the thread safety of the users;
the file picture voice processing module is used for supporting voice, pictures and files sent between a client and a customer service, uploading the voice, pictures and files to the server in a binary stream mode, returning the stored path address after the voice, pictures and files are uploaded, and storing the address in a cache;
for the case of multiple chat rooms, the adaptive client page module at the front end of the chat window comprises the following steps:
the system background is dynamically distributed with a plurality of customer services, each customer service role is the group owner of the corresponding chat room in the front-end page chat window, when a customer logs in, the system automatically distributes the customer service roles to the corresponding chat rooms according to the hash value represented by the login user to realize load balance, and the front-end page module displays the chat history records of the customer and the customer service in the chat room where the customer is located.
2. The WebSocket and cache-based multi-terminal online chat system of claim 1, wherein: the thread safety method of the multithreading safety processing module comprises the following steps: self-defining local thread variables, or using a read security lock and a write security lock syncronized, or using a ConcurrentHashMap thread Security Map under a java.
CN201911384141.7A 2019-12-28 2019-12-28 WebSocket and cache-based multi-terminal online chat system Active CN111106996B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911384141.7A CN111106996B (en) 2019-12-28 2019-12-28 WebSocket and cache-based multi-terminal online chat system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911384141.7A CN111106996B (en) 2019-12-28 2019-12-28 WebSocket and cache-based multi-terminal online chat system

Publications (2)

Publication Number Publication Date
CN111106996A CN111106996A (en) 2020-05-05
CN111106996B true CN111106996B (en) 2022-04-12

Family

ID=70424391

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911384141.7A Active CN111106996B (en) 2019-12-28 2019-12-28 WebSocket and cache-based multi-terminal online chat system

Country Status (1)

Country Link
CN (1) CN111106996B (en)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111739151A (en) * 2020-06-18 2020-10-02 国网山西省电力公司晋中供电公司 Three-dimensional simulation scene management method for transformer substation
CN112202904A (en) * 2020-09-30 2021-01-08 深圳壹账通智能科技有限公司 Information interaction method, device and medium
CN112073207B (en) * 2020-11-16 2021-02-09 广州易方信息科技股份有限公司 Method, device and computer equipment for reducing message bandwidth of chat room
CN113302881B (en) * 2020-12-01 2023-05-02 百果园技术(新加坡)有限公司 Method, device, chat terminal, server and storage medium for realizing online chat
CN112653747A (en) * 2020-12-17 2021-04-13 青岛以萨数据技术有限公司 Communication method, system and storage medium based on B/S architecture
CN112637343A (en) * 2020-12-23 2021-04-09 中国建设银行股份有限公司 File transmission method, device and system
CN112802477A (en) * 2020-12-30 2021-05-14 科大国创云网科技有限公司 Customer service assistant tool service method and system based on voice-to-text conversion
CN112968963B (en) * 2021-02-23 2023-03-24 上海昊沧系统控制技术有限责任公司 WebSocket-based method for forced real-time offline of user
CN113157466A (en) * 2021-04-27 2021-07-23 上海销氪信息科技有限公司 Message pushing method, device, system, electronic equipment and storage medium
CN116016409A (en) * 2023-01-10 2023-04-25 浪潮软件股份有限公司 Online chat system

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104751340A (en) * 2015-03-25 2015-07-01 北京京东尚科信息技术有限公司 Customer service division method and system

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102045270B (en) * 2010-11-30 2012-12-19 北京迅捷英翔网络科技有限公司 Chat server system, method for constructing chat server system and chat system
CN103856394A (en) * 2014-03-20 2014-06-11 沈阳化工大学 Online chat room system
CN107995013B (en) * 2016-10-26 2020-08-18 腾讯科技(深圳)有限公司 Customer service distribution method and device
US20180234506A1 (en) * 2017-02-14 2018-08-16 Gu Zhang System and methods for establishing virtual connections between applications in different ip networks

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104751340A (en) * 2015-03-25 2015-07-01 北京京东尚科信息技术有限公司 Customer service division method and system

Also Published As

Publication number Publication date
CN111106996A (en) 2020-05-05

Similar Documents

Publication Publication Date Title
CN111106996B (en) WebSocket and cache-based multi-terminal online chat system
US10986057B2 (en) Message history display system and method
US11138564B2 (en) Setting permissions for links forwarded in electronic messages
US8402095B2 (en) Apparatus and method for instant messaging collaboration
US11159475B2 (en) Sending a read receipt to each user specified on a read receipt distribution list
US10693816B2 (en) Communication methods and systems, electronic devices, and computer clusters
US6801603B1 (en) Online aggregation
US9961125B2 (en) Messaging API over HTTP protocol to establish context for data exchange
CN108200544A (en) Short message delivery method and SMS platform
US20160269341A1 (en) Distribution of endorsement indications in communication environments
US20150039675A1 (en) Messaging over http protocol for data exchange
US9686214B2 (en) Status and time-based delivery services for instant messengers
EP2308214A1 (en) The method and apparatus for the resource sharing between user devices in computer network
US11528232B1 (en) Apparatus and method for handling real-time tasks with diverse size based on message queue
CN114629866A (en) Method for establishing real-time communication between multiple systems by random online customer service
US9942177B1 (en) Method and system for real-time data updates
US9264260B2 (en) System and method of handling read and delivery confirmations for messages
US9948581B2 (en) Allow hidden and silent observers in a group conversation
WO2021059113A1 (en) Cachability of single page applications
US20090132659A1 (en) Enhancing Collaboration Opportunities for a Reply to an Electronic Message
US20160283514A1 (en) Information processing method and electronic device
US20110161984A1 (en) Collaboration in low bandwidth applications
JP2018533797A (en) Information transmission method and apparatus
CN115955450A (en) Instant message display method, instant message push method, instant message display device, instant message push device, electronic equipment and storage medium
CN112600853A (en) Non-existing equipment server screenshot method, device and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant