CN111262779A - Method, device, server and system for acquiring data in instant messaging - Google Patents

Method, device, server and system for acquiring data in instant messaging Download PDF

Info

Publication number
CN111262779A
CN111262779A CN202010072628.8A CN202010072628A CN111262779A CN 111262779 A CN111262779 A CN 111262779A CN 202010072628 A CN202010072628 A CN 202010072628A CN 111262779 A CN111262779 A CN 111262779A
Authority
CN
China
Prior art keywords
data
client
acquired
management server
server
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.)
Pending
Application number
CN202010072628.8A
Other languages
Chinese (zh)
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.)
Zhuomi Private Ltd
Original Assignee
Hong Kong LiveMe Corp 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 Hong Kong LiveMe Corp Ltd filed Critical Hong Kong LiveMe Corp Ltd
Priority to CN202010072628.8A priority Critical patent/CN111262779A/en
Publication of CN111262779A publication Critical patent/CN111262779A/en
Pending legal-status Critical Current

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]
    • H04L51/046Interoperability with other network applications or services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/66Arrangements for connecting between networks having differing types of switching systems, e.g. gateways
    • 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/222Monitoring or handling of messages using geographical location information, e.g. messages transmitted or received in proximity of a certain spot or area
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)

Abstract

The embodiment of the invention provides a method, a device, a server and a system for acquiring data in instant messaging. The method for acquiring the data in the instant messaging is applied to a management server of the instant messaging system; the instant communication system also comprises a client and a gateway server; a long connection is established between the management server and the client; the management server and the gateway server belong to the same local area network; when a data acquisition request sent by the client is received, the local area network is used for requesting data to be acquired from the gateway server based on the data acquisition request, so that the gateway server returns the data to be acquired to the management server by using the local area network; and when the data to be acquired is received, sending the data to be acquired to the client. The scheme can improve the data acquisition efficiency in instant messaging.

Description

Method, device, server and system for acquiring data in instant messaging
Technical Field
The present invention relates to the field of instant messaging technologies, and in particular, to a method, an apparatus, a server, and a system for acquiring data in instant messaging.
Background
To improve user experience, in addition to providing a service for online chatting, the instant messaging system may access an application using HTTP (hypertext transfer protocol) to acquire data of the application, thereby providing a service on the acquired data. For example, a certain instant messaging system can access a news platform by using a hypertext transfer protocol to acquire news data and provide news display service for users; accessing a user mailbox, acquiring user mailbox data and providing a mail management service for the user; accessing a video platform, acquiring video data, providing video playing service for users, and the like.
In the related art, when the instant messaging system accesses the application to obtain the data of the application by using the hypertext transfer protocol, a short connection is established between a client of the instant messaging system and a gateway server, and then the application is accessed through the gateway server. The short connection has the characteristic that the connection is interrupted when one task is finished, and each time data is acquired by using the hypertext transfer protocol, the task can be regarded as one time. Therefore, the client needs to establish a connection with the gateway server once for each data acquisition.
However, the user is likely to use a plurality of services in a short time, so that the client acquires data by using the hypertext transfer protocol several times in a short time, and accordingly, the connection between the client and the gateway server needs to be established several times. Moreover, three handshakes are needed to establish connection every time, which causes the time cost of data acquisition to rise and the data acquisition efficiency to decline.
Disclosure of Invention
The embodiment of the invention aims to provide a method, a device, a server and a system for acquiring data in instant messaging, so as to achieve the effect of improving the efficiency of acquiring data in instant messaging. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present invention provides a method for acquiring data in instant messaging, which is applied to a management server of an instant messaging system, where the instant messaging system further includes a client and a gateway server; a long connection is established between the management server and the client; the management server and the gateway server belong to the same local area network; the method comprises the following steps:
when a data acquisition request sent by the client is received, the local area network is used for requesting data to be acquired from the gateway server based on the data acquisition request, so that the gateway server returns the data to be acquired to the management server by using the local area network;
and when the data to be acquired is received, sending the data to be acquired to the client.
Optionally, the requesting, by using the local area network, data to be acquired from the gateway server based on the data acquisition request includes:
acquiring user information corresponding to the data acquisition request and a data identifier of data to be acquired;
packaging the user information and the data identification into a data acquisition request in a binary format;
and sending the data acquisition request in the binary format to the gateway server by using the local area network.
Optionally, the method further includes:
detecting whether any one of the long connection and the local area network is abnormal;
and if the data to be acquired is abnormal, the client is indicated to establish short connection with the gateway server, and the client is indicated to request the gateway server for the data to be acquired by utilizing a hypertext transfer protocol.
Optionally, when receiving the data to be acquired, sending the data to be acquired to the client includes:
when the data to be acquired is received, carrying out serialization processing on the data to be acquired to obtain serialized data;
and packaging the serialized data into binary format data and sending the binary format data to the client.
Optionally, the long connection between the management server and the client is established by the following steps:
the method comprises the steps that when a management server receives a long connection establishment request sent by a client, position information of the client is obtained;
and according to the position information, allocating the access server closest to the client position to the client so that the client establishes a long connection with the management server through the allocated access server.
In a second aspect, an embodiment of the present invention provides an apparatus for acquiring data in instant messaging, which is applied to a management server of an instant messaging system; the instant communication system also comprises a client and a gateway server; a long connection is established between the management server and the client; the management server and the gateway server belong to the same local area network; the device includes:
the data request module is used for requesting data to be acquired from the gateway server by using the local area network based on the data acquisition request when receiving the data acquisition request sent by the client, so that the gateway server returns the data to be acquired to the management server by using the local area network;
and the data sending module is used for sending the data to be acquired to the client when receiving the data to be acquired.
Optionally, the data request module is specifically configured to:
acquiring user information corresponding to the data acquisition request and a data identifier of data to be acquired;
packaging the user information and the data identification into a data acquisition request in a binary format;
and sending the data acquisition request in the binary format to the gateway server by using the local area network.
Optionally, the apparatus further comprises: a switching module to:
detecting whether any one of the long connection and the local area network is abnormal;
and if the data to be acquired is abnormal, the client is indicated to establish short connection with the gateway server, and the client is indicated to request the gateway server for the data to be acquired by utilizing a hypertext transfer protocol.
Optionally, the data sending module is specifically configured to:
when the data to be acquired is received, carrying out serialization processing on the data to be acquired to obtain serialized data;
and packaging the serialized data into binary format data and sending the binary format data to the client.
Optionally, the long connection between the management server and the client is established by the following steps:
the method comprises the steps that when a management server receives a long connection establishment request sent by a client, position information of the client is obtained;
and according to the position information, allocating the access server closest to the client position to the client so that the client establishes a long connection with the management server through the allocated access server.
In a third aspect, an embodiment of the present invention provides an instant messaging system, where the system includes:
a management server, a client and a gateway server; a long connection is established between the management server and the client; the management server and the gateway server belong to the same local area network;
the client is used for sending a data acquisition request to the management server; receiving data to be acquired sent by the management server;
the management server is used for requesting data to be acquired from the gateway server by using the local area network based on the data acquisition request when receiving the data acquisition request sent by the client; when the data to be acquired is received, sending the data to be acquired to the client;
and the gateway server is used for returning the data to be acquired to the management server by using the local area network.
In a fourth aspect, an embodiment of the present invention provides a server, where the server includes:
the system comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the bus; a memory for storing a computer program; and the processor is used for executing the program stored in the memory and realizing the steps of the method for acquiring the data in the instant messaging provided by the first aspect.
In a fifth aspect, an embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored in the storage medium, and when the computer program is executed by a processor, the steps of the method for acquiring data in instant messaging provided in the first aspect are implemented.
In the scheme provided by the embodiment of the invention, when receiving a data acquisition request sent by a client, a management server requests data to be acquired from a gateway server by using a local area network based on the data acquisition request, so that the gateway server returns the data to be acquired to the management server; and the management server can send the received data to be acquired to the client when receiving the data to be acquired. The management server establishes long connection with the client, and can reduce the three-way handshake process for establishing connection compared with the process of establishing short connection for multiple times; in addition, the management server and the gateway server belong to the same local area network, and the data acquisition efficiency is relatively high. Therefore, compared with the method that the client directly accesses the gateway server to acquire the data to be acquired in a short connection mode, the time delay caused by three-way handshake and the time delay caused by the client accessing the gateway server in another area can be reduced, the time cost of data acquisition is reduced, and the data acquisition efficiency in instant messaging is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below.
Fig. 1 is a schematic flow chart illustrating a method for acquiring data in instant messaging according to an embodiment of the present invention;
fig. 2 is a schematic flow chart illustrating a method for acquiring data in instant messaging according to another embodiment of the present invention;
fig. 3 is a schematic structural diagram of an apparatus for acquiring data in instant messaging according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an instant messaging system according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a server according to an embodiment of the present invention.
Detailed Description
In order to make those skilled in the art better understand the technical solution of the present invention, the technical solution 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 only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
First, a method for acquiring data in instant messaging according to an embodiment of the present invention is described below.
The method for acquiring data in instant messaging provided by the embodiment of the present invention may be applied to a management server in an instant messaging system, and in a specific application, the management server may include a desktop computer, a portable computer, an internet television, an intelligent mobile terminal, a server, a wearable intelligent terminal, and the like. Moreover, the communication system may further include a client and a gateway server. A long connection is established between the management server and the client; the management server and the gateway server belong to the same local area network.
As shown in fig. 1, a flow of a method for acquiring data in instant messaging according to an embodiment of the present invention may include:
s101, the client sends a data acquisition request to the management server.
In a specific application, the sending timing of the data obtaining request may be specifically when the client requests to use a service corresponding to the data obtained by the data obtaining request. For example, when a client of the instant messaging system requests a service related to video playing, the client may send a data acquisition request related to video data to the management server. The data acquisition request is used for requesting data to be acquired. The data to be acquired is used to implement a service with respect to the acquired data. For example, the data to be acquired may specifically be video data, an interface of a video application, an interface of a mailbox platform, news data, and the like.
S102, when receiving a data acquisition request sent by a client, a management server requests data to be acquired from a gateway server by using a local area network based on the data acquisition request.
The management server may specifically request the gateway server for the data to be acquired by using the local area network based on the data acquisition request in various ways. For example, the management server may directly send a data acquisition request to the gateway server using the local area network to request the data to be acquired. Or, for example, the management server may obtain the user information corresponding to the data obtaining request and the data identifier of the data to be obtained, process the user information and the data identifier of the data to be obtained into the data obtaining request in a format convenient for transmission, and send the processed data obtaining request to the gateway server by using the local area network to request to carry the data to be obtained. For ease of understanding and reasonable layout, the second exemplary description is specifically illustrated in the following embodiment of fig. 2 of the present invention.
Any way that the management server requests the gateway server for the data to be acquired by using the local area network based on the data acquisition request can be used in the present invention, which is not limited in this embodiment. In addition, in order to reduce the pressure of the management server and improve the performance of the management server, the management server may instruct the local area network serving as the data acquisition server to request the gateway server for the data to be acquired by using a remote procedure call based on the data acquisition request. The data acquisition server is equivalent to a transfer station between the management server and the gateway server and is used for sharing the pressure of the management server.
And S103, the gateway server returns the data to be acquired to the management server by using the local area network.
In order to reduce the reduction of data acquisition efficiency caused by data transmission delay, the gateway server and the management server are in the same local area network. At this time, when the management server requests the gateway server for the data to be acquired by using the local area network and the gateway server returns the data to be acquired to the management server by using the local area network, the transmission speed of the data is relatively higher than that when the client directly interacts with the gateway server in a network in a different area from the client. Therefore, the acquisition efficiency of the data to be acquired can be improved.
And S104, when receiving the data to be acquired, the management server sends the data to be acquired to the client.
Because the long connection is established between the management server and the client, the client sends a data acquisition request to the management server, and when the management server sends the received data to be acquired to the client, the established long connection can still be used even if the data is requested for multiple times and acquired for multiple times. Compared with the short connection used when the client side directly interacts with the gateway server, the method does not need to pass through the three-way handshake process every time, and can greatly reduce the data acquisition delay caused by the three-way handshake process. Moreover, because the long connection is established between the management server and the client, the security of the client and the long connection communication can be relatively improved compared with the case of directly establishing the long connection between the client and the gateway server.
Illustratively, in an instant messaging system, diverse services can be provided for more than 1300 interfaces. If these interfaces are acquired by using short connections of HTTP, the interface acquisition is too slow, the loading time is too long when the page corresponding to the interface is entered, and other problems are caused. By the long connection mechanism, the acquisition speed of the interface and the page loading efficiency can be improved by about 2/3, the acquisition speed of the interface is preferably improved, the waiting time of a user is reduced, and the user experience is greatly improved.
In the scheme provided by the embodiment of the invention, when receiving a data acquisition request sent by a client, a management server requests data to be acquired from a gateway server by using a local area network based on the data acquisition request, so that the gateway server returns the data to be acquired to the management server; and the management server can send the received data to be acquired to the client when receiving the data to be acquired. The management server establishes long connection with the client, and can reduce the three-way handshake process for establishing connection compared with the process of establishing short connection for multiple times; in addition, the management server and the gateway server belong to the same local area network, and the data acquisition efficiency is relatively high. Therefore, compared with the method that the client directly accesses the gateway server to acquire the data to be acquired in a short connection mode, the time delay caused by three-way handshake and the time delay caused by the client accessing the gateway server in another area can be reduced, the time cost of data acquisition is reduced, and the data acquisition efficiency in instant messaging is improved.
As shown in fig. 2, a flow of a method for acquiring data in instant messaging according to another embodiment of the present invention may include:
s201, the client sends a data acquisition request to the management server.
The above step S201 is the same as step S101 in the embodiment of fig. 1, and is not repeated herein, for details, see the description of the embodiment of fig. 1.
S202, when receiving a data acquisition request sent by a client, the management server acquires user information corresponding to the data acquisition request and a data identifier of data to be acquired, and encapsulates the user information and the data identifier into the data acquisition request in a binary format.
The management server may obtain the user information corresponding to the data obtaining request and the data identifier of the data to be obtained in a variety of ways. For example, when the data obtaining request carries the user information and the data identifier of the data to be obtained, the management server may directly extract the user information and the data identifier of the data to be obtained from the data obtaining request. Alternatively, for example, when the user information and the data identifier of the data to be acquired are sent independently of the data acquisition request, the management server may receive the user information and the data identifier of the data to be acquired, which are sent synchronously with the data acquisition request.
The method for encapsulating the user information and the data identifier into the data acquisition request in the binary format by the management server specifically includes: the management server carries out serialization processing on the user information and the data identification respectively to obtain the user information in the binary format and the data identification in the binary format, encapsulates the user information in the binary format and the data identification in the binary format into a request conforming to a Transmission Control Protocol (TCP), and obtains a data acquisition request in the binary format.
S203, the data acquisition request in the binary format is sent to the gateway server by using the local area network.
The above step S203 is similar to the step of sending the data obtaining request to the gateway server in S202 in the embodiment of fig. 1 of the present invention, and the difference is that the format of the data obtaining request in S203 is binary, so that the occupation of bandwidth can be relatively reduced, and the transmission efficiency can be improved.
And S204, the gateway server returns the data to be acquired to the management server by using the local area network.
S205, when receiving the data to be acquired, the management server sends the data to be acquired to the client.
The above-mentioned steps S204 to S205 are the same as the steps S103 to S104 in the embodiment of fig. 1, and are not repeated herein, for details, see the description of the embodiment of fig. 1.
In the embodiment of fig. 2, the management server encapsulates the user information and the data identifier into the data acquisition request in the binary format, and the amount of the binary format data acquisition request is the same, so that the amount of the binary format data acquisition request is small, and the bandwidth occupation and the transmission efficiency can be reduced. Moreover, the data acquisition request comprises user information, which is equivalent to simulating an account number of a user to access the gateway server, and the access success rate can be improved for the condition that the identity of the user needs to be verified.
In an optional implementation manner, the method for acquiring data in an instant messaging system provided in the embodiment of the present invention may further include the following steps:
detecting whether any one of the long connection and the local area network is abnormal;
and if the data is abnormal, the client is indicated to establish short connection with the gateway server, and the client is indicated to request the gateway server for the data to be acquired by utilizing the hypertext transfer protocol.
In order to reduce data acquisition delay caused by waiting for fault repair and improve data acquisition efficiency and availability of an instant messaging system when a long connection between a management server and a client and the same local area network where the management server and a gateway server are located have a fault, switching to short connection interaction between the client and the gateway server can be performed when any one of the long connection and the local area network is detected to be abnormal. Specifically, when any one of the long connection and the local area network is abnormal, data acquisition cannot be performed through the long connection mechanism, so the management server may instruct the client to establish a short connection with the gateway server and instruct the client to request the gateway server for data to be acquired by using the hypertext transfer protocol.
The management server may detect whether any one of the long connection and the local area network is abnormal in a plurality of ways. For example, the management server may determine that a long connection abnormality is detected when receiving a notification about the long connection abnormality sent by the client. Or, for example, the management server may monitor whether a long connection with the client is abnormal in a heartbeat mechanism. The heartbeat mechanism is a self-defined structure body sent regularly: heartbeat packets give the opposite party a mechanism to let the opposite party know that he is still alive to ensure the validity of the connection. Alternatively, the management server may determine that the local area network abnormality is detected, for example, when receiving the notification about the local area network abnormality. Or, the management server may monitor whether the connection established with the gateway server through the local area network is abnormal by using a heartbeat mechanism; if so, it may be determined that a local area network anomaly is detected. Any way of detecting whether any one of the long connection and the local area network is abnormal by the management server can be used in the present invention, and this embodiment does not limit this.
Optionally, when receiving the data to be acquired, the sending the data to be acquired to the client may specifically include the following steps:
when data to be acquired is received, carrying out serialization processing on the data to be acquired to obtain serialized data;
and packaging the serialized data into data in binary format and sending the data to the client.
Similar to the data acquisition request in binary format acquired by the management server, the management server may perform serialization processing on the data to be acquired when receiving the data to be acquired, so as to obtain serialized data; and further packaging the serialized data into data in binary format and sending the data to the client. Therefore, the volume of the acquired data can be reduced through the serialized data in the binary format, the data can be encrypted through serialization, and the data security is improved.
Optionally, the long connection between the management server and the client is established by the following steps:
the method comprises the steps that when a long connection establishment request sent by a client is received by a management server, position information of the client is obtained;
according to the position information, the access server closest to the position of the client is allocated to the client, so that the client establishes a long connection with the management server through the allocated access server.
In a particular application, the client of the instant messaging system is likely to be in a remote area from the management server. For example, the management server is in Beijing, and the client is likely in New York. In contrast, in order to establish a long connection with the management server at a relatively shortest communication distance, the communication speed is increased, and the data acquisition efficiency is further improved. The management server may obtain location information of the client when receiving a long connection establishment request sent by the client. On the basis of the above, the management server may allocate the access server closest to the location of the client to the client according to the location information, and thus, the client establishes a long connection with the management server through the allocated access server, and the data transmission speed is relatively high for a long connection with a relatively shortest communication distance.
The location information of the client may specifically include a country code indicating a country where the client is located in the client identifier, or an IP address of the client. Also, the manner in which the management server acquires the location information of the client may be various. For example, the management server may extract the location information of the client from a long connection establishment request sent by the client. Or, for example, the management server may read an identifier of the client from a long connection establishment request sent by the client, and search location information corresponding to the read identifier of the client from a pre-stored correspondence between the identifier of the client and the location information. In addition, the access server is specifically a proxy server for establishing a connection between the client and the management server. The long connection establishment request of the client may be transmitted to the management server by a navigation server already deployed in the communication network.
Corresponding to the above method embodiment, an embodiment of the present invention further provides a device for acquiring data in instant messaging.
As shown in fig. 3, the apparatus for acquiring data in instant messaging according to an embodiment of the present invention is applied to a management server of an instant messaging system; the instant communication system also comprises a client and a gateway server; a long connection is established between the management server and the client; the management server and the gateway server belong to the same local area network; the apparatus may include:
a data request module 301, configured to, when receiving a data acquisition request sent by the client, request, based on the data acquisition request, data to be acquired from the gateway server by using the local area network, so that the gateway server returns the data to be acquired to the management server by using the local area network;
a data sending module 302, configured to send the data to be acquired to the client when receiving the data to be acquired.
In the scheme provided by the embodiment of the invention, when receiving a data acquisition request sent by a client, a management server requests data to be acquired from a gateway server by using a local area network based on the data acquisition request, so that the gateway server returns the data to be acquired to the management server; and the management server can send the received data to be acquired to the client when receiving the data to be acquired. The management server establishes long connection with the client, and can reduce the three-way handshake process for establishing connection compared with the process of establishing short connection for multiple times; in addition, the management server and the gateway server belong to the same local area network, and the data acquisition efficiency is relatively high. Therefore, compared with the method that the client directly accesses the gateway server to acquire the data to be acquired in a short connection mode, the time delay caused by three-way handshake and the time delay caused by the client accessing the gateway server in another area can be reduced, the time cost of data acquisition is reduced, and the data acquisition efficiency in instant messaging is improved.
Optionally, the data requesting module 301 is specifically configured to:
acquiring user information corresponding to the data acquisition request and a data identifier of data to be acquired;
packaging the user information and the data identification into a data acquisition request in a binary format;
and sending the data acquisition request in the binary format to the gateway server by using the local area network.
Optionally, the apparatus further comprises: a switching module to:
detecting whether any one of the long connection and the local area network is abnormal;
and if the data to be acquired is abnormal, the client is indicated to establish short connection with the gateway server, and the client is indicated to request the gateway server for the data to be acquired by utilizing a hypertext transfer protocol.
Optionally, the data sending module 302 is specifically configured to:
when the data to be acquired is received, carrying out serialization processing on the data to be acquired to obtain serialized data;
and packaging the serialized data into binary format data and sending the binary format data to the client.
Optionally, the long connection between the management server and the client is established by the following steps:
the method comprises the steps that when a management server receives a long connection establishment request sent by a client, position information of the client is obtained;
and according to the position information, allocating the access server closest to the client position to the client so that the client establishes a long connection with the management server through the allocated access server.
As shown in fig. 4, an instant messaging system according to an embodiment of the present invention includes:
a management server 401, a client 402, and a gateway server 403; a long connection is established between the management server 401 and the client 402; the management server 401 and the gateway server 403 belong to the same local area network;
the client 402 is configured to send a data acquisition request to the management server 401; receiving data to be acquired sent by the management server 401;
the management server 401 is configured to, when receiving a data acquisition request sent by the client 402, request, based on the data acquisition request, data to be acquired from the gateway server 403 by using the local area network; when receiving the data to be acquired, sending the data to be acquired to the client 402;
the gateway server 403 is configured to return the data to be acquired to the management server 401 by using the local area network.
In the scheme provided by the embodiment of the invention, when receiving a data acquisition request sent by a client, a management server requests data to be acquired from a gateway server by using a local area network based on the data acquisition request, so that the gateway server returns the data to be acquired to the management server; and the management server can send the received data to be acquired to the client when receiving the data to be acquired. The management server establishes long connection with the client, and can reduce the three-way handshake process for establishing connection compared with the process of establishing short connection for multiple times; in addition, the management server and the gateway server belong to the same local area network, and the data acquisition efficiency is relatively high. Therefore, compared with the method that the client directly accesses the gateway server to acquire the data to be acquired in a short connection mode, the time delay caused by three-way handshake and the time delay caused by the client accessing the gateway server in another area can be reduced, the time cost of data acquisition is reduced, and the data acquisition efficiency in instant messaging is improved.
Corresponding to the foregoing embodiment, an embodiment of the present invention further provides a server, and as shown in fig. 5, the server may include:
the system comprises a processor 501, a communication interface 502, a memory 503 and a communication bus 504, wherein the processor 501, the communication interface 502 and the memory complete mutual communication through the communication bus 504 through the 503;
a memory 503 for storing a computer program;
the processor 501 is configured to implement the steps of any method for acquiring data in instant messaging applied to the management server in the foregoing embodiments when executing the computer program stored in the memory 503.
In a specific application, the server in this embodiment is a management server in an instant messaging system.
In the scheme provided by the embodiment of the invention, when receiving a data acquisition request sent by a client, a management server requests data to be acquired from a gateway server by using a local area network based on the data acquisition request, so that the gateway server returns the data to be acquired to the management server; and the management server can send the received data to be acquired to the client when receiving the data to be acquired. The management server establishes long connection with the client, and can reduce the three-way handshake process for establishing connection compared with the process of establishing short connection for multiple times; in addition, the management server and the gateway server belong to the same local area network, and the data acquisition efficiency is relatively high. Therefore, compared with the method that the client directly accesses the gateway server to acquire the data to be acquired in a short connection mode, the time delay caused by three-way handshake and the time delay caused by the client accessing the gateway server in another area can be reduced, the time cost of data acquisition is reduced, and the data acquisition efficiency in instant messaging is improved.
The Memory may include a RAM (Random Access Memory) or an NVM (Non-Volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field-Programmable Gate Array) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component.
The computer-readable storage medium provided by an embodiment of the present invention is contained in a server, and a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements any of the steps of the method for acquiring data in instant messaging applied to a management server in the above embodiments.
In the scheme provided by the embodiment of the invention, when receiving a data acquisition request sent by a client, a management server requests data to be acquired from a gateway server by using a local area network based on the data acquisition request, so that the gateway server returns the data to be acquired to the management server; and the management server can send the received data to be acquired to the client when receiving the data to be acquired. The management server establishes long connection with the client, and can reduce the three-way handshake process for establishing connection compared with the process of establishing short connection for multiple times; in addition, the management server and the gateway server belong to the same local area network, and the data acquisition efficiency is relatively high. Therefore, compared with the method that the client directly accesses the gateway server to acquire the data to be acquired in a short connection mode, the time delay caused by three-way handshake and the time delay caused by the client accessing the gateway server in another area can be reduced, the time cost of data acquisition is reduced, and the data acquisition efficiency in instant messaging is improved.
In another embodiment of the present invention, a computer program product containing instructions is provided, which when run on a computer, causes the computer to execute the method for acquiring data in instant messaging according to any one of the above embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in or transmitted from a computer-readable storage medium to another computer-readable storage medium, for example, from a website, computer, server, or data center, over a wired (e.g., coaxial cable, fiber optic, DSL (Digital Subscriber Line), or wireless (e.g., infrared, radio, microwave, etc.) network, to another website, computer, server, or data center, to any available medium that is accessible by a computer or that is a data storage device including one or more integrated servers, data centers, etc. the available medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD (Digital Versatile Disc, digital versatile disc)), or a semiconductor medium (e.g.: SSD (Solid state disk)), etc.
In this document, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the apparatus, system and server embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference may be made to some descriptions of the method embodiments for relevant points.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (10)

1. A method for obtaining data in instant communication is characterized in that the method is applied to a management server of an instant communication system; the instant communication system also comprises a client and a gateway server; a long connection is established between the management server and the client; the management server and the gateway server belong to the same local area network; the method comprises the following steps:
when a data acquisition request sent by the client is received, the local area network is used for requesting data to be acquired from the gateway server based on the data acquisition request, so that the gateway server returns the data to be acquired to the management server by using the local area network;
and when the data to be acquired is received, sending the data to be acquired to the client.
2. The method of claim 1, wherein the requesting data to be acquired from the gateway server using the local area network based on the data acquisition request comprises:
acquiring user information corresponding to the data acquisition request and a data identifier of data to be acquired;
packaging the user information and the data identification into a data acquisition request in a binary format;
and sending the data acquisition request in the binary format to the gateway server by using the local area network.
3. The method of claim 1, further comprising:
detecting whether any one of the long connection and the local area network is abnormal;
and if the data to be acquired is abnormal, the client is indicated to establish short connection with the gateway server, and the client is indicated to request the gateway server for the data to be acquired by utilizing a hypertext transfer protocol.
4. The method according to claim 1, wherein the sending the data to be acquired to the client when receiving the data to be acquired comprises:
when the data to be acquired is received, carrying out serialization processing on the data to be acquired to obtain serialized data;
and packaging the serialized data into binary format data and sending the binary format data to the client.
5. Method according to any of claims 1 to 4, characterized in that the long connection between the management server and the client is established by the following steps:
the method comprises the steps that when a management server receives a long connection establishment request sent by a client, position information of the client is obtained;
and according to the position information, allocating the access server closest to the client position to the client so that the client establishes a long connection with the management server through the allocated access server.
6. The device for acquiring data in instant messaging is characterized by being applied to a management server of an instant messaging system; the instant communication system also comprises a client and a gateway server; a long connection is established between the management server and the client; the management server and the gateway server belong to the same local area network; the device comprises:
the data request module is used for requesting data to be acquired from the gateway server by using the local area network based on the data acquisition request when receiving the data acquisition request sent by the client, so that the gateway server returns the data to be acquired to the management server by using the local area network;
and the data sending module is used for sending the data to be acquired to the client when receiving the data to be acquired.
7. The apparatus of claim 6, wherein the data request module is specifically configured to:
acquiring user information corresponding to the data acquisition request and a data identifier of data to be acquired;
packaging the user information and the data identification into a data acquisition request in a binary format;
and sending the data acquisition request in the binary format to the gateway server by using the local area network.
8. An instant messaging system, the system comprising: a management server, a client and a gateway server; a long connection is established between the management server and the client; the management server and the gateway server belong to the same local area network;
the client is used for sending a data acquisition request to the management server; receiving data to be acquired sent by the management server;
the management server is used for requesting data to be acquired from the gateway server by using the local area network based on the data acquisition request when receiving the data acquisition request sent by the client; when the data to be acquired is received, sending the data to be acquired to the client;
and the gateway server is used for returning the data to be acquired to the management server by using the local area network.
9. A server is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the bus; the memory is used for storing a computer program; the processor, configured to execute the program stored in the memory, to implement the method steps according to any one of claims 1-5.
10. A computer-readable storage medium, characterized in that a computer program is stored in the storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of claims 1-5.
CN202010072628.8A 2020-01-21 2020-01-21 Method, device, server and system for acquiring data in instant messaging Pending CN111262779A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010072628.8A CN111262779A (en) 2020-01-21 2020-01-21 Method, device, server and system for acquiring data in instant messaging

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010072628.8A CN111262779A (en) 2020-01-21 2020-01-21 Method, device, server and system for acquiring data in instant messaging

Publications (1)

Publication Number Publication Date
CN111262779A true CN111262779A (en) 2020-06-09

Family

ID=70952633

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010072628.8A Pending CN111262779A (en) 2020-01-21 2020-01-21 Method, device, server and system for acquiring data in instant messaging

Country Status (1)

Country Link
CN (1) CN111262779A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112583926A (en) * 2020-12-23 2021-03-30 平安银行股份有限公司 Short-link switching method, system, computer equipment and storage medium
CN113347234A (en) * 2021-05-21 2021-09-03 微民保险代理有限公司 Network information acquisition method, device, system, computer equipment and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102761864A (en) * 2011-04-29 2012-10-31 中国移动通信集团公司 Data transmission method, system and device
CN103546543A (en) * 2013-09-29 2014-01-29 北京京东尚科信息技术有限公司 Client device for electronic commerce and method and system for supplying information
US20140258409A1 (en) * 2013-01-30 2014-09-11 Tencent Technology (Shenzhen) Company Limited Method, server and browser for pushing message actively
CN105871977A (en) * 2015-11-27 2016-08-17 乐视体育文化产业发展(北京)有限公司 Long connection establishment method and system, and devices
CN107483327A (en) * 2017-09-05 2017-12-15 江苏电力信息技术有限公司 A kind of instant communication method based on long Connection Service independent
CN108512743A (en) * 2018-03-06 2018-09-07 北京奇艺世纪科技有限公司 LAN instant messaging method of servicing, device and electronic equipment
CN110493353A (en) * 2019-09-05 2019-11-22 香港乐蜜有限公司 Communication means, device and server

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102761864A (en) * 2011-04-29 2012-10-31 中国移动通信集团公司 Data transmission method, system and device
US20140258409A1 (en) * 2013-01-30 2014-09-11 Tencent Technology (Shenzhen) Company Limited Method, server and browser for pushing message actively
CN103546543A (en) * 2013-09-29 2014-01-29 北京京东尚科信息技术有限公司 Client device for electronic commerce and method and system for supplying information
CN105871977A (en) * 2015-11-27 2016-08-17 乐视体育文化产业发展(北京)有限公司 Long connection establishment method and system, and devices
CN107483327A (en) * 2017-09-05 2017-12-15 江苏电力信息技术有限公司 A kind of instant communication method based on long Connection Service independent
CN108512743A (en) * 2018-03-06 2018-09-07 北京奇艺世纪科技有限公司 LAN instant messaging method of servicing, device and electronic equipment
CN110493353A (en) * 2019-09-05 2019-11-22 香港乐蜜有限公司 Communication means, device and server

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112583926A (en) * 2020-12-23 2021-03-30 平安银行股份有限公司 Short-link switching method, system, computer equipment and storage medium
CN112583926B (en) * 2020-12-23 2023-04-07 平安银行股份有限公司 Short-link switching method, system, computer equipment and storage medium
CN113347234A (en) * 2021-05-21 2021-09-03 微民保险代理有限公司 Network information acquisition method, device, system, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
CN109561141B (en) CDN node selection method and equipment
US9444759B2 (en) Service provider registration by a content broker
WO2021057889A1 (en) Data processing method and apparatus, electronic device, and storage medium
CN108449312B (en) Protocol conversion method, device, system and gateway
RU2498520C2 (en) Method of providing peer-to-peer communication on web page
CN113489636B (en) Location-based access control for manual dialog entities
CN111786998A (en) Authority management method and device based on micro-service calling and storage medium
CN107360261A (en) A kind of HTTP request processing method, device and electronic equipment
CN110958281A (en) Data transmission method and communication device based on Internet of things
CN108429739B (en) Method, system and terminal equipment for identifying honeypots
WO2017101186A1 (en) Method for establishing wireless connection for application of user equipment
CN114979295B (en) Gateway management method and device
EP3185598A1 (en) Application registration method and apparatus
CN111262779A (en) Method, device, server and system for acquiring data in instant messaging
CN112769671B (en) Message processing method, device and system
CN113037888A (en) Method and device for accelerating configuration of domain name, storage medium and electronic equipment
CN113067803B (en) Resource isolation system, request processing method and request processing device
CN103023684A (en) Method, device and system for network information management
CN108541000B (en) Method, medium and device for detecting network connection
CN109618004A (en) A kind of message forwarding method and device
CN107222365B (en) Data processing method and device and server
CN109347904B (en) Method and system for establishing communication link
CN110708293B (en) Method and device for distributing multimedia service
CN101753561B (en) Business cluster processing method and cluster system
CN113285920B (en) Service access method, device, equipment and storage 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
TA01 Transfer of patent application right

Effective date of registration: 20210524

Address after: 25, 5th floor, shuangjingfang office building, 3 frisha street, Singapore

Applicant after: Zhuomi Private Ltd.

Address before: Room 1101, Santai Commercial Building, 139 Connaught Road, Hong Kong, China

Applicant before: HONG KONG LIVE.ME Corp.,Ltd.

TA01 Transfer of patent application right
RJ01 Rejection of invention patent application after publication

Application publication date: 20200609

RJ01 Rejection of invention patent application after publication