CN112019625A - Websocket-based message pushing method, system, equipment and medium - Google Patents

Websocket-based message pushing method, system, equipment and medium Download PDF

Info

Publication number
CN112019625A
CN112019625A CN202010894605.5A CN202010894605A CN112019625A CN 112019625 A CN112019625 A CN 112019625A CN 202010894605 A CN202010894605 A CN 202010894605A CN 112019625 A CN112019625 A CN 112019625A
Authority
CN
China
Prior art keywords
public network
websocket
client
server
message
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.)
Granted
Application number
CN202010894605.5A
Other languages
Chinese (zh)
Other versions
CN112019625B (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.)
Chongqing Unisinsight Technology Co Ltd
Original Assignee
Chongqing Unisinsight 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 Chongqing Unisinsight Technology Co Ltd filed Critical Chongqing Unisinsight Technology Co Ltd
Priority to CN202010894605.5A priority Critical patent/CN112019625B/en
Publication of CN112019625A publication Critical patent/CN112019625A/en
Application granted granted Critical
Publication of CN112019625B publication Critical patent/CN112019625B/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
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/55Push-based network services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/02Network architectures or network communication protocols for network security for separating internal from external traffic, e.g. firewalls
    • 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/10Protocols in which an application is distributed across nodes in the network
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer And Data Communications (AREA)

Abstract

The application provides a websocket-based message pushing method, a websocket-based message pushing system, websocket-based message pushing equipment and a websocket-based message pushing medium, wherein the websocket-based message pushing system comprises: the system comprises a public network client and a public network server deployed in a public network, wherein the public network server is connected with an intranet server through a firewall; the public network server is a server cluster, wherein a full-duplex data flow channel between the public network and the intranet is established based on a websocket protocol, and real-time message pushing of the public network and the intranet is achieved. The method and the system realize cross-domain communication based on the websocket protocol, realize message push between the public network and the internal network, do not need to separately deploy a server, additionally open a firewall port and integrate a specific client component, are simple to deploy and convenient to use, and support a high-concurrency service scene.

Description

Websocket-based message pushing method, system, equipment and medium
Technical Field
The present application relates to the field of data communication technologies, and in particular, to a websocket-based message push method, system, device, and medium.
Background
In the security industry, in order to protect the security of data, each service system is deployed in different network domains, a common application scenario is that a core system related to sensitive data is deployed in a private (internal) network, some peripheral service systems based on the core system are deployed in a public network environment, and access between network domains is controlled by firewall systems between different network domains.
However, the more current solutions are to deploy specialized communication systems, such as Kafka, ActiveMQ, and some commercial messaging systems, which basically require separate deployment servers, integration of specific client components, and complicated usage.
Disclosure of Invention
In view of the foregoing drawbacks of the prior art, an object of the present application is to provide a method, a system, a device, and a medium for pushing a message based on a websocket, so as to solve the problem that a message pushing system in the prior art is complicated to network.
To achieve the above and other related objects, the present application provides a websocket-based message pushing system, including:
the system comprises a public network client and a public network server deployed in a public network, wherein the public network server is connected with an intranet server through a firewall; the public network server is a server cluster, wherein a full-duplex data flow channel between the public network and the intranet is established based on a websocket protocol, and real-time message pushing of the public network and the intranet is achieved.
Another objective of the present application is to provide a websocket-based message pushing method, including:
when the verification is detected to be legal, establishing websocket connection between the public network client and the public network server;
configuring a firewall port, and establishing a full-duplex communication channel between a public network and an internal network based on a websocket protocol;
transmitting the received data to a public network server by using a full duplex communication channel;
the public network server processes the data in a cluster mode to realize message pushing to a public network client;
when detecting that a message of a corresponding type from an intranet server is received, calling a subscription client of a corresponding topic in the subscription client object queue, establishing a websocket channel with a public network server through the topic and a unique client identifier, and sending the message to the corresponding client to realize message pushing;
when a message with the type identification of the intranet server as type _ ID is detected, the unique identification of the client is extracted by using the type _ ID, and a websocket channel is established according to topic and the unique identification of the client to realize point-to-point pushing of the specific message to the specific client.
Another object of the present application is to provide an electronic device, comprising:
one or more processing devices;
a memory for storing one or more programs; when the one or more programs are executed by the one or more processing devices, the one or more processing devices are caused to execute the websocket-based message pushing method.
It is a further object of the present application to provide a computer-readable storage medium, having a computer program stored thereon, where the computer program is used to make the computer execute the websocket-based message pushing method.
As described above, the websocket-based message push method, system, device and medium of the present application have the following beneficial effects:
the method and the system realize cross-domain communication based on the websocket protocol, realize message push between the public network and the internal network, do not need to separately deploy a server, additionally open a firewall port and integrate a specific client component, are simple to deploy and convenient to use, and support a high-concurrency service scene.
Drawings
FIG. 1 shows a block diagram of a websocket-based message push system provided in the present application;
FIG. 2 is a schematic structural diagram of a websocket-based message push system provided in the present application;
fig. 3 is a block diagram illustrating a structure of a publish/subscribe message push module in a websocket-based message push system according to the present application;
fig. 4 shows a block diagram of a point-to-point message pushing module in a websocket-based message pushing system provided by the present application;
fig. 5 shows a flowchart of a websocket-based message pushing method provided in the present application;
fig. 6 shows a schematic structural diagram of an electronic device provided in the present application.
Detailed Description
The following description of the embodiments of the present application is provided by way of specific examples, and other advantages and effects of the present application will be readily apparent to those skilled in the art from the disclosure herein. The present application is capable of other and different embodiments and its several details are capable of modifications and/or changes in various respects, all without departing from the spirit of the present application. It is to be noted that the features in the following embodiments and examples may be combined with each other without conflict.
It should be noted that the drawings provided in the following embodiments are only for illustrating the basic idea of the present application, and the drawings only show the components related to the present application and are not drawn according to the number, shape and size of the components in actual implementation, and the type, number and proportion of the components in actual implementation may be changed freely, and the layout of the components may be more complicated.
Websocket is a protocol for full duplex communication on a single TCP connection, data exchange between a client and a server is simpler through Websocket, the server is allowed to actively push data to the client, and in the Websocket interface, a browser and the server can directly establish persistent connection and perform bidirectional data transmission only by completing one handshake.
Referring to fig. 1, a structural block diagram of a websocket-based message pushing system provided in the present application includes:
the system comprises a public network client and a public network server deployed in a public network, wherein the public network server is connected with an intranet server through a firewall; the public network server is a server cluster, wherein a full-duplex data flow channel between the public network and the intranet is established based on a websocket protocol, and real-time message pushing of the public network and the intranet is achieved.
The public network deploys a server cluster (public network server) consisting of a plurality of peripheral service servers, and the requirement of high concurrency is met; if the number of the clients supported by the peripheral service is not large and high concurrency requirements do not exist, the public network server can be replaced by a single-node server, so that the service requirements are met.
The public network client and the public network server establish one WebSocket connection, the public network server and the intranet server establish the other WebSocket connection, real-time response of communication between the client and the server can be realized when the connection is successful, the client does not need to establish connection with a server (the public network server or the intranet server) every time the client initiates a request, the communication efficiency is effectively improved, and the bandwidth and resource consumption of the server are reduced.
Specifically, the public network client is connected with a public network server through authentication and authorization, and the public network server receives real-time data generated by core services from the intranet server and sends the data to the intranet server for processing. And connecting a firewall between the public network client and the public network server and between the public network server and the intranet to the intranet server through a firewall port, thereby forming a complete full-duplex data flow channel based on the websocket protocol.
In this embodiment, cross-domain communication is realized based on a websocket protocol, message push between a public network and an intranet is realized, a server does not need to be separately deployed, a firewall port is additionally opened, and a specific client component is integrated, so that the whole system is simple to deploy, convenient to use, and supports a high-concurrency service scenario.
Referring to fig. 2, a schematic structural diagram of a websocket-based message pushing system is provided in the present application, where the public network server further includes:
the peripheral service module is used for processing peripheral services;
the websocket client module is used for carrying out full-duplex communication with the core service of the intranet based on a websocket protocol through a firewall-opened service port between the public network and the intranet;
the first websocket server module is in full-duplex communication with each public network client based on a websocket protocol;
and the communication control module is used for controlling the communication between the public network client and the first websocket server module.
It should be noted that the communication control module may control the entire system to enter the peer-to-peer message push mode and/or the subscribe/publish message push mode.
The intranet server comprises a core service module and a second websocket server module which are integrated on one server.
It should be noted that, the core service system is deployed in the intranet server, the intranet server includes a core service module and a second wbsocket service module, and the second wbsocket service module and the core service module are integrated together, so that when the cross-domain communication is performed, the full-duplex communication service shares a port with the service, and it is not necessary to additionally open a separate port on the firewall for the full-duplex communication service.
Wherein the communication control module further comprises: a subscription/publishing message push mode, which is used for setting a plurality of topics of different types in a public network server, assembling a subscription client object according to a client ID and a subscription identifier and storing the subscription client object in a subscription client object queue; and when detecting that the message of the corresponding type from the intranet server is received, calling the corresponding topic subscription client in the subscription client object queue, establishing a websocket channel with the public network server through the topic and the unique client identifier, and sending the message to the corresponding client.
And controlling whether the subscription in the subscription client object queue is released or not by changing the state of the subscription identifier.
It should be noted that, an extranet server (extranet server side) sets a plurality of topics for pushing different types of messages, an extranet client is connected with the extranet server side through the topic and a unique client identifier ID, and sets a subscription identifier to true to send, the extranet server side assembles the client ID and the subscription identifier into a subscription client object to be stored in a subscription client object queue of the corresponding topic, when a message of a corresponding type in an intranet reaches the extranet server side, the extranet server side takes out the subscription client object of the subscription client object queue of the corresponding topic, and when the subscription identifier is true, the message is sent to the corresponding client through a websocket channel established by the topic and the unique client identifier ID. When a client needs to release the message subscription of the corresponding topic, the subscription identifier is set to be false through a websocket channel established by the corresponding topic and the unique identifier ID of the client and is sent to an external network server, the server sets the subscription identifier of the corresponding topic to be false in a subscription client object queue, and thus the subscription is released.
In the embodiment, the message pushing is realized in a subscription mode, so that the aim of accurate popularization is fulfilled, and meanwhile, the precision and the efficiency of the message pushing are improved.
Wherein the communication control module further comprises: and the point-to-point message pushing mode is used for setting a topic of a specific message and a type identification type _ ID of specific data in the public network server, extracting a unique client identification by using the type _ ID when a message with the type identification of the intranet server as the type _ ID is detected, and establishing a websocket channel according to the unique topic client identification to realize point-to-point pushing of the specific message to the specific client.
And the public network server stores the client identification corresponding to the specific data to the map according to the type identification type _ ID of the specific data.
It should be noted that the topic for pushing a specific message and the type identifier type _ ID for specific data are set at the extranet server side. The extranet client is connected with an extranet server (extranet server end) through topic and the unique client identification ID, the type of the specific data is identified as type _ ID, the extranet client receives the specific data with the type identification as type _ ID, and the extranet server end stores the type _ ID as a key and the client ID as a value into map. When a message with type identification of type _ ID transmitted from an internal network to a server side of an external network arrives, the client ID is taken out through the type _ ID, and the specific message is pushed to a specific client in a point-to-point mode through the unique identification ID of a topoc client.
In the embodiment, the transmission of the specific message is realized through point-to-point, so that the system is improved to meet different requirements of various users, and the compatibility of the message pushing system is improved; meanwhile, instant messages are pushed by using the websocket, CPU, memory and network bandwidth resources of the server are fully utilized, pushing delay is effectively solved, high pushing concurrency is achieved, and few pushing consumed resources are achieved.
In another embodiment, the intranet server pushes messages to each node of the public network server cluster in a broadcasting mode, and the messages are communicated with each public network server node in a broadcasting mode, and the mode is simple in design and high in efficiency, and can ensure that each public network server node independently processes services for pushing data to the public network client; meanwhile, communication is not needed among the public network server clusters, and computing resources can be effectively saved.
In another embodiment, each node of the server cluster stores cluster node information, wherein the cluster node information includes a cluster node IP, port information, and node connection information; the public network client acquires and stores the cluster node information, and when detecting that a certain public network server node cannot be used, a standby public network server node is selected from the cluster node information for connection; and updating the stored cluster node information and synchronizing the cluster node information to a server cluster.
For example, once it is detected that the connected public network server node a cannot be used, the information of the public network server node a stored by the public network client is updated and set as unavailable, and the unavailable information of the public network server node a is synchronized to the public network server cluster, so that each public network server node can update and know the situation in time; and meanwhile, selecting standby public network server nodes (node IP and port information) from the locally stored cluster node information for connection, wherein during connection, the public network server node with the minimum number of connected public network clients is preferably connected to ensure normal use and load balance of the push service, and the reliability of the push service is improved.
In another embodiment, a full duplex communication process between a peripheral service network domain (public network) public network client (e.g., a mobile phone or a browser client) and a core service network domain (i.e., an intranet) is shown in fig. 1, and the detailed steps are as follows:
the public network client sends a websocket connection request to the public network server, and when the connection request is sent, permission verification information needs to be attached. And the verification information is prepared without error, and the public network server and the public network client establish websocket connection.
When the intranet server and the public network server are installed and deployed, an open port configuration is performed on the firewall, for example, an 8080 port is selected as a communication port between the public network and the intranet, and after the port is opened, a high-speed full-duplex communication channel is established between the public network and the intranet based on a websocket communication protocol to perform real-time communication.
The intranet is connected with a real-time picture or a structured data stream generated by the image and video acquisition equipment information, and pushes data to a public network server side in real time through a websocket full-duplex communication channel of the public network.
The plurality of public network service terminals form a public network service terminal cluster, data transmitted from the internal network are subjected to real-time service processing, and are pushed to the public network client terminal in real time under the control of the public network service terminal websocket communication control module.
As shown in fig. 3, the public network server has a plurality of topics for publishing/subscribing, the public network client establishes a websocket channel to the public network server with the client unique identifier client _ id through a certain topic1, and sets the subscription identifier is _ sub _ flag to true through the channel to send the subscription identifier is _ sub _ flag. The public network server side assembles client _ id and is _ sub _ flag into a subscription client object subObject which is stored in a subscription client queue of the topic1, when a message which belongs to the topic1 from an internal network arrives, the public network server side can take out all objects in the subscription client queue of the topic1, and when the is _ sub _ flow of a certain object is true, the public network server side sends the message through a websocket connecting channel which is established by the topic1+ the client terminal and uniquely identifies the client _ id. When a client wants to unsubscribe, the client sets the is _ sub _ flag to be false and sends the is _ sub _ flag through a websocket connection channel established by the topic1 and the client-side unique identification client _ id, and the public network server sets the is _ sub _ flag of the client-side object subscribed by the client _ id to be false and then unsubscribes.
A peer-to-peer message pushing module, as shown in fig. 4, a client of the public network sets a topic _ p2p for pushing a specific message peer-to-peer and a type identifier type _ id of a plurality of specific messages, the client of the public network establishes a websocket connection channel with a client unique identifier client _ id1 through the topic _ p2p, the type identifier type _ id1 of the specific message to be received is sent through the channel, the server of the public network takes the type _ id1 as a key, the client _ id1 is stored in the map, when the specific message with the type identifier type _ id1 from the internal network arrives, the client _ id1 is taken out according to the type _ id1, and the specific peer-to-peer message pushing is realized through a websocket channel established by the topic _ p2p and the client unique identifier client _ id 1.
In the embodiment, based on the websocket cross-domain communication technology, message subscription/publishing and point-to-point message pushing are realized. Because the service module and the full-duplex communication module are fused on one server, service and a firewall port do not need to be separately deployed for full-duplex communication, and an additional communication assembly does not need to be integrated.
Referring to fig. 5, a flowchart of a websocket-based message pushing method provided in the present application includes:
step S1, when the verification is detected to be legal, establishing websocket connection between the public network client and the public network server;
step S2, configuring a firewall port, and establishing a full-duplex communication channel between the public network and the intranet based on the websocket protocol;
step S3, transmitting the received data to a public network server by using a full duplex communication channel;
step S4, the public network server processes the data in a cluster mode to realize message pushing to the public network client;
step S5, when detecting that the message of the corresponding type from the intranet server is received, calling the subscribing client of the corresponding topic in the subscribing client object queue, establishing a websocket channel with the public network server through the topic and the unique client identifier, and sending the message to the corresponding client to realize message push;
step S6, when detecting the message from the intranet server type identification as type _ ID, extracting the unique client identification by using the type _ ID, and establishing a websocket channel according to topic and the unique client identification to realize point-to-point pushing of the specific message to the specific client.
It should be further noted that the websocket-based message pushing system and the websocket-based message pushing method are in a one-to-one correspondence relationship, and here, the technical details and technical effects of the process steps S1-S6 related to the websocket-based message pushing system are the same, and are not described herein one by one, please refer to the websocket-based message pushing system.
Referring now to fig. 6, there is shown a schematic block diagram of an electronic device (e.g., a terminal device or a server 600) suitable for implementing the present embodiment, the terminal device in the present embodiment may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet), a PMP (portable multimedia player), a vehicle mounted terminal (e.g., a car navigation terminal), etc., and a fixed terminal such as a digital TV, a desktop computer, etc., the electronic device shown in fig. 6 is only an example and should not bring any limitations to the functions and the scope of use of the present embodiment.
As shown in fig. 6, electronic device 600 may include a processing means (e.g., central processing unit, graphics processor, etc.) 601 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage means 608 into a Random Access Memory (RAM) 603. In the RAM603, various programs and data necessary for the operation of the electronic apparatus 600 are also stored. The processing device 601, the ROM602, and the RAM603 are connected to each other via a bus 604. An input/output (I/O) interface 606 is also connected to bus 604.
Generally, the following devices may be connected to the I/O interface 606: input devices 606 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 606 including, for example, a Liquid Crystal Display (LCD), speakers, vibrators, or the like; storage 608 including, for example, tape, hard disk, etc.; and a communication device 609. The communication means 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. While fig. 6 illustrates an electronic device 600 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to the present embodiment, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, the present embodiments include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication means 609, or may be installed from the storage means 608, or may be installed from the ROM 602. When executed by the processing device 601, performs the above-described functions defined in the methods of the embodiments of the present disclosure
It should be noted that the computer readable medium can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. A computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In this embodiment, however, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: acquiring a data set, wherein the data set is a plurality of human images acquired by the same person under different scenes; distributing the portrait in the data set to corresponding bayonet equipment according to the number of the bayonet equipment, the distributed geographic position and a preset time period to form images which are arranged in a time sequence and represent the portrait track, and form images which are arranged in the time sequence and represent the portrait track; and clustering and archiving the image by using the platform to be tested, and calculating the index of clustering and classification.
Computer program code for carrying out operations for aspects of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of methods and computer program products according to various embodiments disclosed herein. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
To sum up, the method and the system realize cross-domain communication based on the websocket protocol, realize message push between the public network and the intranet, do not need to separately deploy a server, additionally open a firewall port and integrate a specific client component, are simple to deploy, are convenient to use, and support high-concurrency service scenes.
The above embodiments are merely illustrative of the principles and utilities of the present application and are not intended to limit the application. Any person skilled in the art can modify or change the above-described embodiments without departing from the spirit and scope of the present application. Accordingly, it is intended that all equivalent modifications or changes which can be made by those skilled in the art without departing from the spirit and technical concepts disclosed in the present application shall be covered by the claims of the present application.

Claims (12)

1. A message pushing system based on websocket is characterized by comprising: the system comprises a public network client and a public network server deployed in a public network, wherein the public network server is connected with an intranet server through a firewall; the public network server is a server cluster, wherein a full-duplex data flow channel between the public network and the intranet is established based on a websocket protocol, and real-time message pushing of the public network and the intranet is achieved.
2. The websocket-based message pushing system of claim 1, wherein the public network server comprises:
the peripheral service module is used for processing peripheral services;
the websocket client module is used for carrying out full-duplex communication with the core service of the intranet based on a websocket protocol through a firewall-opened service port between the public network and the intranet;
the first websocket server module is in full-duplex communication with each public network client based on a websocket protocol; and the communication control module is used for controlling the communication between the public network client and the first websocket server module.
3. The websocket-based message pushing system of claim 2, wherein the communication control module comprises: a subscription/publishing message push mode, which is used for setting a plurality of topics of different types in a public network server, assembling a subscription client object according to a client ID and a subscription identifier and storing the subscription client object in a subscription client object queue; and when detecting that the message of the corresponding type from the intranet server is received, calling the corresponding topic subscription client in the subscription client object queue, establishing a websocket channel with the public network server through the topic and the unique client identifier, and sending the message to the corresponding client.
4. The websocket-based message pushing system of claim 3, wherein whether to unsubscribe from the subscribing client object queue is controlled by changing a state of a subscription identifier.
5. The websocket-based message pushing system of claim 2, wherein the communication control module further comprises: and the point-to-point message pushing mode is used for setting a topic of a specific message and a type identification type _ ID of specific data in the public network server, extracting a unique client identification by using the type _ ID when a message with the type identification of the intranet server as the type _ ID is detected, and establishing a websocket channel according to the topic and the unique client identification to realize point-to-point pushing of the specific message to the specific client.
6. The websocket-based message pushing system of claim 5, wherein the public network server stores the client identifier corresponding to the specific data to the map based on a type identifier type _ ID of the specific data.
7. The websocket-based message pushing system of claim 1, wherein the intranet server comprises a core service module and a second websocket server module integrated on one server.
8. The websocket-based message pushing system of claim 1 or 7, wherein the intranet server pushes messages to each node of the public network server cluster in a broadcast manner.
9. The websocket-based message pushing system of claim 1, wherein each node of the server cluster stores cluster node information, the cluster node information including a cluster node IP, port information, and node connection information; the public network client acquires and stores the cluster node information, and when detecting that a certain public network server node cannot be used, a standby public network server node is selected from the cluster node information for connection; and updating the stored cluster node information and synchronizing the cluster node information to a server cluster.
10. A websocket-based message pushing method is characterized by comprising the following steps:
when the verification is detected to be legal, establishing websocket connection between the public network client and the public network server;
configuring a firewall port, and establishing a full-duplex communication channel between a public network and an internal network based on a websocket protocol;
transmitting the received data to a public network server by using a full duplex communication channel;
the public network server processes the data in a cluster mode to realize message pushing to a public network client;
when detecting that a message of a corresponding type from an intranet server is received, calling a subscription client of a corresponding topic in the subscription client object queue, establishing a websocket channel with a public network server through the topic and a unique client identifier, and sending the message to the corresponding client to realize message pushing;
when a message with the type identification of the intranet server as type _ ID is detected, the unique identification of the client is extracted by using the type _ ID, and a websocket channel is established according to topic and the unique identification of the client to realize point-to-point pushing of the specific message to the specific client.
11. An electronic device, characterized in that: the method comprises the following steps:
one or more processing devices;
a memory for storing one or more programs; when executed by the one or more processing devices, cause the one or more processing devices to implement the websocket-based message push method of claim 10.
12. A computer-readable storage medium having a computer program stored thereon, wherein the computer program is configured to make the computer execute the websocket-based message pushing method of claim 10.
CN202010894605.5A 2020-08-31 2020-08-31 Websocket-based message pushing method, system, device and medium Active CN112019625B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010894605.5A CN112019625B (en) 2020-08-31 2020-08-31 Websocket-based message pushing method, system, device and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010894605.5A CN112019625B (en) 2020-08-31 2020-08-31 Websocket-based message pushing method, system, device and medium

Publications (2)

Publication Number Publication Date
CN112019625A true CN112019625A (en) 2020-12-01
CN112019625B CN112019625B (en) 2023-01-31

Family

ID=73503233

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010894605.5A Active CN112019625B (en) 2020-08-31 2020-08-31 Websocket-based message pushing method, system, device and medium

Country Status (1)

Country Link
CN (1) CN112019625B (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113112255A (en) * 2021-04-19 2021-07-13 中国工商银行股份有限公司 Distributed message processing method, apparatus, device, medium, and program product
CN113596117A (en) * 2021-07-14 2021-11-02 北京淇瑀信息科技有限公司 Real-time data processing method, system, device and medium
CN113766010A (en) * 2021-08-09 2021-12-07 深圳前海爱客风信息技术有限公司 Data stream processing method and device
CN113965628A (en) * 2020-12-03 2022-01-21 广州三叠纪元智能科技有限公司 Message scheduling method, server and storage medium
CN114553945A (en) * 2022-01-15 2022-05-27 江苏秉信科技有限公司 Message pushing method for power intranet cloud platform-crossing unified framework gateway
CN117411762A (en) * 2023-10-25 2024-01-16 中国科学院空天信息创新研究院 Distributed message transmission method, device, equipment and medium
CN118138443A (en) * 2024-05-08 2024-06-04 善诊(上海)信息技术有限公司 Log acquisition method, system and computer readable storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017113816A1 (en) * 2015-12-29 2017-07-06 乐视控股(北京)有限公司 Method and device for peer-to-peer network connection
CN108390950A (en) * 2018-05-28 2018-08-10 中国建设银行股份有限公司 A kind of information push method, device and equipment
CN109194637A (en) * 2018-08-23 2019-01-11 深圳点猫科技有限公司 It is a kind of for educating the intranet and extranet means of communication and system of cloud platform
CN110300050A (en) * 2019-05-23 2019-10-01 中国平安人寿保险股份有限公司 Information push method, device, computer equipment and storage medium
US20190363899A1 (en) * 2018-05-25 2019-11-28 Slack Technologies, Inc. Multiplexing message distribution within group-based communication system
US20190380060A1 (en) * 2018-06-12 2019-12-12 Verizon Patent And Licensing Inc. SYSTEMS AND METHODS FOR APN BASED CoS AND QoS CONTROL FOR NETWORK SERVICES
CN110661858A (en) * 2019-09-12 2020-01-07 南京博联智能科技有限公司 Websocket-based intranet penetration method and system

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017113816A1 (en) * 2015-12-29 2017-07-06 乐视控股(北京)有限公司 Method and device for peer-to-peer network connection
US20190363899A1 (en) * 2018-05-25 2019-11-28 Slack Technologies, Inc. Multiplexing message distribution within group-based communication system
CN108390950A (en) * 2018-05-28 2018-08-10 中国建设银行股份有限公司 A kind of information push method, device and equipment
US20190380060A1 (en) * 2018-06-12 2019-12-12 Verizon Patent And Licensing Inc. SYSTEMS AND METHODS FOR APN BASED CoS AND QoS CONTROL FOR NETWORK SERVICES
CN109194637A (en) * 2018-08-23 2019-01-11 深圳点猫科技有限公司 It is a kind of for educating the intranet and extranet means of communication and system of cloud platform
CN110300050A (en) * 2019-05-23 2019-10-01 中国平安人寿保险股份有限公司 Information push method, device, computer equipment and storage medium
CN110661858A (en) * 2019-09-12 2020-01-07 南京博联智能科技有限公司 Websocket-based intranet penetration method and system

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
0X0001ECHO: ""websocket服务器外网访问"", 《HTTPS://BLOG.CSDN.NET/》 *
吴英宾: ""一种内外网数据交互系统的设计与实现"", 《软件工程》 *

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113965628A (en) * 2020-12-03 2022-01-21 广州三叠纪元智能科技有限公司 Message scheduling method, server and storage medium
CN113112255A (en) * 2021-04-19 2021-07-13 中国工商银行股份有限公司 Distributed message processing method, apparatus, device, medium, and program product
CN113596117A (en) * 2021-07-14 2021-11-02 北京淇瑀信息科技有限公司 Real-time data processing method, system, device and medium
CN113596117B (en) * 2021-07-14 2023-09-08 北京淇瑀信息科技有限公司 Real-time data processing method, system, equipment and medium
CN113766010A (en) * 2021-08-09 2021-12-07 深圳前海爱客风信息技术有限公司 Data stream processing method and device
CN114553945A (en) * 2022-01-15 2022-05-27 江苏秉信科技有限公司 Message pushing method for power intranet cloud platform-crossing unified framework gateway
CN117411762A (en) * 2023-10-25 2024-01-16 中国科学院空天信息创新研究院 Distributed message transmission method, device, equipment and medium
CN118138443A (en) * 2024-05-08 2024-06-04 善诊(上海)信息技术有限公司 Log acquisition method, system and computer readable storage medium
CN118138443B (en) * 2024-05-08 2024-07-12 善诊(上海)信息技术有限公司 Log acquisition method, system and computer readable storage medium

Also Published As

Publication number Publication date
CN112019625B (en) 2023-01-31

Similar Documents

Publication Publication Date Title
CN112019625B (en) Websocket-based message pushing method, system, device and medium
CN111246228B (en) Method, device, medium and electronic equipment for updating gift resources of live broadcast room
CN112291629B (en) Interaction method, interaction device, electronic equipment and readable medium
CN110781373B (en) List updating method and device, readable medium and electronic equipment
CN110996372B (en) Message routing method, device and system and electronic equipment
WO2023000888A1 (en) Cloud application implementing method and apparatus, electronic device, and storage medium
CN111309415B (en) User Interface (UI) information processing method and device of application program and electronic equipment
CN111432001B (en) Method, apparatus, electronic device and computer readable medium for jumping scenes
CN115022106B (en) Group information processing method, device, equipment and medium
CN111698574A (en) Video watermark processing method and device, electronic equipment and storage medium
CN114489891A (en) Control method, system, device, readable medium and equipment of cloud application program
CN113596530A (en) Method and device for transferring data
US11848762B2 (en) Live broadcast stream pushing method and apparatus, and electronic device
CN111212296B (en) Live broadcast room gift list configuration method, device, medium and electronic equipment
CN111444457B (en) Data release method and device, storage medium and electronic equipment
CN114363449B (en) Service state switching method and device, electronic equipment and storage medium
CN114417905B (en) Information transmission method, apparatus, device and computer readable medium
CN111246229B (en) Method, device, medium and electronic equipment for updating gift resources of live broadcast room
CN114513548B (en) Directional call information processing method and device
CN110855767B (en) Method, device, equipment and storage medium for responding operation request
CN118138790A (en) Data stream switching method and device, storage medium and electronic equipment
CN113157365A (en) Program running method and device, electronic equipment and computer readable medium
CN116302223A (en) Page display method and device, electronic equipment and storage medium
CN116126263A (en) Non-mirror image screen projection method, device, equipment and storage medium
CN117278706A (en) Connection processing method, device, equipment 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