CN114301891B - Python-based Web service and Socket client interaction method and system - Google Patents

Python-based Web service and Socket client interaction method and system Download PDF

Info

Publication number
CN114301891B
CN114301891B CN202111613288.6A CN202111613288A CN114301891B CN 114301891 B CN114301891 B CN 114301891B CN 202111613288 A CN202111613288 A CN 202111613288A CN 114301891 B CN114301891 B CN 114301891B
Authority
CN
China
Prior art keywords
socket
module
service
web service
client
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111613288.6A
Other languages
Chinese (zh)
Other versions
CN114301891A (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.)
Beijing Zhongke Flux Technology Co ltd
Original Assignee
Beijing Ruixin High Throughput 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 Beijing Ruixin High Throughput Technology Co ltd filed Critical Beijing Ruixin High Throughput Technology Co ltd
Priority to CN202111613288.6A priority Critical patent/CN114301891B/en
Publication of CN114301891A publication Critical patent/CN114301891A/en
Application granted granted Critical
Publication of CN114301891B publication Critical patent/CN114301891B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention provides a Python-based Web service and Socket client interaction method and system, wherein the system comprises the following steps: an external web server, an internal server and a Socket client; the internal server comprises a master control module, an internal web service module, a Socket service module, a bridging module and an http message sending module; the bridging module comprises a global variable unit, a Socket client instance and an ID binding relation table, and a synchronous waiting handle and ID binding relation table; the bridging module is a middle layer module for connecting the internal Web service business module and the Socket service business module. The scheme effectively ensures the message sequence in the communication between the external web service and the client, and solves the problems of concurrent communication of multiple clients, long response time and the like.

Description

Python-based Web service and Socket client interaction method and system
Technical Field
The invention relates to the fields of server data interaction and data processing, in particular to a method and a system for interaction between a Python-based Web service and a Socket client.
Background
Web services include Websocket and http services, socket services including tcp and udp services. Python can be used for Web service development and Socket service development, and current mature Web application frameworks of Python comprise flash, django, tornado and the like.
In the manner that the commonly used web server in the market is connected with the socket client, the following potential problems exist:
1. the existing external Web service and Socket client can be developed in any language, so that the service between different development languages needs to be conveniently connected, the cross-platform requirement exists, and direct service connection cannot be performed;
2. the external Web service can inquire information from one or more designated Socket clients, and generally in the case, the response result is either overtime return error or response data waiting for the designated Socket clients, so as to perform the next data interaction;
3. in some specific requirements, an external Web service is required to push messages to all Socket clients and does not require a response;
4. the Socket client may request data from the external Web service, with the result being either a timeout return error or a wait for a response to the external Web service.
Therefore, a service end needs to be designed to serve an external Web service and a Socket client group respectively, so that the potential requirements can be simultaneously met, concurrent communication and synchronous communication can be realized between the Web service and the Socket client, a waiting communication mechanism is realized, and the correct sequence of messages is maintained.
Disclosure of Invention
Aiming at the defects of the prior art, the invention provides a method for effectively mapping multiple applications of chip interconnection, which can support the sharing transmission of data between chips. Specifically, the invention provides the following technical scheme:
in one aspect, the present invention provides a Python-based Web service and Socket client interaction system, where the system includes: an external web server, an internal server and a Socket client;
the internal server comprises a master control module, an internal web service module, a Socket service module, a bridging module and an http message sending module;
the bridging module comprises a global variable unit, a Socket client instance and an ID binding relation table, and a synchronous waiting handle and ID binding relation table;
the bridging module is a middle layer module for connecting the internal Web service business module and the Socket service business module.
Preferably, the master control module performs data interaction with the internal web service module and the Socket service module respectively, and is used for controlling the internal web service module and the Socket service module; the Socket service module is connected with the Socket client and performs data interaction; the internal web service module and the Socket service module are connected with the bridging module, so that bridging conversion between web service and Socket service is realized; the http message sending module receives message data from the Socket service module and sends the data to an external web server; the external web service end performs data interaction with the internal web service business module.
Preferably, the Socket client instance and the ID binding relationship table are used to record a Socket client instance and a unique ID of a Socket client corresponding to the Socket client instance, and based on the Socket client instance, the Socket service module sends a query request. This setting is the basis for ensuring that the external web server can communicate with multiple Socket clients either specified or in parallel.
Preferably, the synchronization waiting handle and ID binding table is configured to store a synchronization waiting handle corresponding to a unique ID of the Socket client, where the synchronization waiting handle is configured to block waiting for a return result from the Socket client after the Socket service module sends a query request. This arrangement can ensure synchronous waiting communication, thereby effectively ensuring no disorder of the information sequence.
Preferably, the global variable unit is configured to store a global variable that can be accessed by the internal web service module and the Socket service module.
Preferably, the global variable can store the real-time state of each Socket client, so that the Web service can conveniently judge whether to issue a request to the corresponding Socket client according to the real-time state of the Socket client; the global variable may also store policy configurations that require attention for both Socket services and Web services, such as which Socket clients may upload data, etc.
On the other hand, the invention also provides a Python-based Web service and Socket client interaction method, which comprises the following steps:
setting a bridging module in a server, wherein the bridging module comprises a global variable unit, a Socket client instance and an ID binding relation table, and a synchronous waiting handle and ID binding relation table; the bridging module realizes bridging conversion between the web service and the Socket service; the server side further comprises: an internal web service module, a Socket service module and an http message sending module;
the steps of the bridge module in communication interaction between the external web server and the Socket client are as follows:
s1, an external web server sends a query request to an internal web service business module;
after the internal web service business module receives the query request of the external web service end, a corresponding Socket client end instance is found based on the unique ID in a Socket client end instance and ID binding relation table, and the query request is sent to the corresponding Socket client end through the Socket service business module;
s2, finding a corresponding synchronous waiting handle according to the unique ID in a synchronous waiting handle and ID binding relation table, and blocking to wait for a return result from a corresponding Socket client after sending a query request;
s3, if the corresponding Socket client returns a result to the Socket service module within a specified time, the internal Web service module ends the blocking state and returns result data to the external Web server;
if the corresponding Socket client does not return the result within the specified time, resetting the synchronous waiting handle, ending the blocking state by the internal Web service business module, and returning a timeout error message to the external Web server.
Preferably, when there is a difference between the protocol of the external web server and that of the Socket client, in S1, the request initiated by the external web server carries the unique ID of one or more Socket clients in the transmitted data packet;
and the bridging module circularly sends a query request to the appointed Socket client based on the unique ID. The message is sent circularly, and the sequence of the message can be ensured in a matching way.
Preferably, the step S3 further includes that after the designated Socket client returns a result to the Socket service module, the Socket service module sequentially returns the result to the internal web service module through the bridging module, and the internal web service module sequentially encapsulates the returned result and the unique ID and returns the result to the external web service terminal.
Preferably, when the external web server sends broadcast data to the Socket client, the sent broadcast data does not contain the unique ID of the Socket client;
at this time, the bridging module notifies the Socket service module to send broadcast data to all Socket clients.
Preferably, when the Socket client sends a request to the external Web server, the Socket service module generates a unique ID for the Socket client after the Socket client establishes a connection.
The Socket business service module sends information of the Socket client to an external web service terminal, wherein the information of the Socket client comprises the newly generated unique ID.
Preferably, for the unique ID generated for the Socket client, transmitting the ID and the connected Socket client instance to a bridge module, and creating a synchronization waiting handle for the ID in the bridge module; and storing the ID and the connected Socket client instance into a Socket client instance and ID binding relation table, and storing the ID and the synchronous waiting handle into a synchronous waiting handle and ID binding relation table.
Preferably, when the communication is performed, the Socket client sends a request to the Socket service module, the Socket service module encapsulates the request message and the unique ID into a data packet, and sends the data packet to the external web server through the http message sending module.
Preferably, the http message sending module is a non-blocking module.
Preferably, the global variable unit can store the real-time state of each Socket client, so that the Web service can conveniently judge whether to issue a request to the corresponding Socket client according to the real-time state of the Socket client; the global variable unit may also store policy configurations that require attention for both Socket services and Web services, such as which Socket clients may upload data, etc.
Compared with the prior art, the scheme of the invention supports the concurrent communication of the external Web service and multiple paths of different Socket clients; external Web services are also supported to communicate with a designated client or clients; in addition, the scheme can realize synchronous waiting communication between the external Web service and the client, namely, the communication flow is not ended until a response result exists or the time is overtime, while the Web communication in the prior art is a stateless communication mechanism.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic structural diagram of a server according to an embodiment of the present invention;
FIG. 2 is an overall architecture diagram in data interaction in accordance with an embodiment of the present invention;
FIG. 3 is a flowchart illustrating a bridge module according to an embodiment of the present invention;
fig. 4 is an interaction flow chart of the external Web service requesting data from the Socket client according to the embodiment of the present invention;
fig. 5 is a data interaction flow chart of broadcasting a message to a Socket client by an external Web service according to an embodiment of the present invention;
fig. 6 is a schematic process diagram of a Socket client responding to an external Web service request according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the drawings in the embodiments of the present invention, and it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without any inventive effort, are intended to be within the scope of the invention.
As shown in fig. 1 and fig. 2, in order to solve the problems in the prior art, in a specific embodiment, the structure of the server module provided by the invention is as follows:
1. in order to realize concurrency, the invention selects a Python non-blocking Web service development architecture, such as flash+gel, and the like;
2. in order to achieve concurrency, socket service (i.e. a Socket service module is implemented) needs to create two python thread after Socket connection is established between the Socket service and each Socket client, which are respectively used for reading data and sending data;
3. in order that the internal Web service and the Socket service can interact, a global bridging module can be developed based on the global technology of Python; the bridge module at least needs to realize the following functions:
(1) The global variables that are accessible to both services are saved. The real-time state of each Socket client can be stored in the global variable, so that the Web service can conveniently judge whether to issue a request to the corresponding Socket client according to the real-time state of the Socket client; the global variable can also store policy configuration which needs attention for both Socket service and Web service, such as which Socket clients can upload data;
(2) Establishing a Socket client instance and ID binding relation table, namely finding out a corresponding Socket client through a unique ID;
(3) The synchronization waiting handle and ID binding relation table is that each unique ID corresponds to one synchronization waiting handle.
In the whole system architecture, the system mainly comprises an external web server, an internal server and a socket client group, wherein the socket client group generally comprises a plurality of clients, and of course, the special case of only one socket client can be included.
The internal server comprises a master control module, an internal web service module, a socket service module, a bridging module and an http message sending module. The general control module is used for controlling the internal web service business module and the socket service business module; the socket service module is connected with a socket client and performs data interaction; the internal web service module and the socket service module are connected with the bridging module, so that bridging conversion between the web service and the socket service is realized; the external web service end performs data interaction with the internal web service business module, such as sending a request and the like; the http message sending module receives message data from the socket service module and sends the data to an external web server.
In a more optimized embodiment, the bridging module includes a global variable unit, a socket client instance and ID binding table, and a synchronization wait handle and ID binding table.
And the Socket service business module sends a query request based on the Socket client instance. This setting is the basis for ensuring that the external web server can communicate with multiple Socket clients either specified or in parallel.
And the synchronous waiting handle and ID binding relation table is used for storing the synchronous waiting handle corresponding to the unique ID of the Socket client, and the synchronous waiting handle is used for blocking and waiting for a return result from the Socket client after the Socket service module sends a query request. This arrangement can ensure synchronous waiting communication, thereby effectively ensuring no disorder of the information sequence.
Based on the above-mentioned basic architecture setting of the system, the following will explain in detail the specific flows under different communication scenarios based on the implementation of communication between the external web server and the Socket client, so as to illustrate the preferred implementation mode of the scheme of the present invention.
1. The external Web server sends a message to the Socket client
The bridging module is a middle layer module for connecting the internal Web service (namely, the internal Web service business module is realized) and the Socket service. The general implementation flow of the bridge module in communication can be described with reference to fig. 3, taking an example that an external Web service sends a message to a Socket client, the process is as follows:
1. after the internal Web service receives an external Web service request, a unique corresponding Socket client instance is found in a Socket client instance and an ID binding relation table according to the attached ID, and a query request is sent in the Socket service;
2. in the synchronous waiting handle and ID binding relation table, finding a unique corresponding synchronous waiting handle according to the ID, and blocking to wait for a return result from a Socket client after sending a query;
3. if the Socket client returns a result to the Socket service within a specified time, the Socket service resets the synchronous waiting handle state, the internal Web service ends the blocking state, and the result data is returned to the external Web service;
4. if the Socket client does not return the result within the set time, the synchronous waiting handle is automatically reset, and at the moment, the internal Web service ends the blocking state and returns a timeout error message to the external Web service.
2. Communication process from external Web service to Socket client
For the above flow, in a more refined embodiment, as shown in fig. 4, when there is a difference between the external web server and the Socket client protocol, the query request initiated by the external web server carries the unique ID of one or more Socket clients in the sent data packet; the bridge module circularly sends a query request to the designated Socket client based on the unique ID. After the designated Socket client returns a result to the Socket service module, the Socket service module sequentially returns the result to the internal web service module through the bridging module, and the internal web service module sequentially encapsulates the returned result and the unique ID and returns the result to the external web service terminal.
In the process of communication from an external Web service to a Socket client, the detailed service interaction process is as follows:
1. when the adopted protocols are different, the internal Web service can be a Web socket service or an http service according to the different protocols; initiating a query request by an external Web service, wherein the transmitted json packet needs to carry one or more client IDs;
2. the internal web service informs Socket service to send a query request to a designated Socket client through a bridging module in a circulating way;
3. the Socket service sequentially sends query messages to the appointed Socket client;
4. after the appointed Socket client receives the query message successively, processing related services, and returning a result message to Socket service;
5. the Socket service sequentially returns result data to the internal Web service through the bridging module;
6. and the internal Web service sequentially packages and encapsulates the result data and the ID as json packets, and returns the json packets to the external Web service.
The flow of the external Web service requesting data from the Socket client is explained by combining the flows of fig. 3 and 4, and the blocked synchronization mechanism is used, so that the order of the messages returned by multiple concurrent requests is ensured not to be disordered.
3. Broadcasting messages to Socket clients
Next, referring to fig. 5, in another specific application scenario, that is, in a scenario of broadcasting a message to a client, broadcast data sent by an external web server to a Socket client does not include a unique ID of the Socket client; at this time, the bridging module notifies the Socket service module to send broadcast data to all Socket clients. This is a special type of communication.
The more specific communication processing flow is as follows:
1. the external web service transmits broadcast data to the internal web service, and at the moment, the json data packet of the transmitted broadcast data does not contain the ID of the Socket client;
2. after receiving the broadcast data, the internal web service informs the Socket service to send the broadcast data to all Socket clients through the bridging module; at this time, more preferably, we can set the internal Web service to default to a broadcast message after receiving the message without ID, and then notify Socket service to send the broadcast message to all Socket clients through the bridging module;
3. and the Socket client receives the broadcast message and completes the sending and receiving of the whole broadcast message. At this time, after receiving the broadcast message, the Socket client does not need to return a response to the Socket service.
4. Socket client requests external Web service
In addition, in another specific embodiment, when the Socket client requests an external Web service, a preferred response procedure is as follows:
1. the Socket client establishes long connection with the Socket service, namely the Socket client sends a request for establishing Socket connection to the Socket service, when the Socket service receives the request, the Socket service establishes connection and generates a unique ID (such as UUID) for the Socket client, wherein the ID is the basis for identifying messages entering and exiting the Socket client; because the ID and the connected Socket client instance can be transferred to the bridge module, a synchronous waiting handle is created for the ID in the bridge module; and storing the ID and the connected Socket client instance into a Socket client instance and ID binding relation table, and storing the ID and the synchronous waiting handle into a synchronous waiting handle and ID binding relation table. Then, the Socket service sends newly added Socket client information to an external Web service, wherein the Socket client information comprises the generated unique ID;
2. thereafter, when communication is performed, the Socket client sends a request to the Socket server, the Socket server (i.e. the Socket service module) encapsulates the request message and the unique ID into a data packet, and the data packet format may be, for example, a json format packet, and sends the json data packet to the external web service by using the http message sending module, and waits for the response of the external web service; note that the http message sending module needs to select a non-blocking module, such as a third party open source requests-future; if the Python official requests module is used, the Socket server thread is blocked, and the concurrency number of Socket server processing is affected.
3. After the external Web service processing is completed, returning the response result to the Socket service in a corresponding format, wherein the corresponding format refers to the format of the received data packet, for example, the data packet in json format is adopted in the last step, and the returned data is returned to the Socket service in the corresponding json format;
the Socket service finds out a corresponding Socket client instance according to the unique ID in the response, and pushes response data to the Socket client according to a communication protocol with the Socket client.
As described above, the flow of the Socket client requesting communication to the external Web service is explained, and the strict synchronization mechanism is used, so that the order of the request return messages is ensured not to be disordered.
In yet another embodiment, the present solution may be implemented by means of an apparatus, which may include corresponding modules performing each or several steps of the above-described embodiments. Thus, each step or several steps of the various embodiments described above may be performed by a respective module, and the electronic device may include one or more of these modules. A module may be one or more hardware modules specifically configured to perform the respective steps, or be implemented by a processor configured to perform the respective steps, or be stored within a computer-readable medium for implementation by a processor, or be implemented by some combination.
The device may be implemented using a bus architecture. The bus architecture may include any number of interconnecting buses and bridges depending on the specific application of the hardware and the overall design constraints. The bus connects together various circuits including one or more processors, memories, and/or hardware modules. The bus may also connect various other circuits such as peripherals, voltage regulators, power management circuits, external antennas, and the like.
The bus may be an industry standard architecture (ISA, industry Standard Architecture) bus, a peripheral component interconnect (PCI, peripheral Component) bus, or an extended industry standard architecture (EISA, extended Industry Standard Component) bus, among others. The buses may be divided into address buses, data buses, control buses, etc. For ease of illustration, only one connection line is shown in the figure, but not only one bus or one type of bus.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and further implementations are included within the scope of the preferred embodiment of the present invention in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the embodiment of the present invention. The processor performs the various methods and processes described above. For example, method embodiments in the present solution may be implemented as a software program tangibly embodied on a machine-readable medium, such as a memory. In some embodiments, part or all of the software program may be loaded and/or installed via memory and/or a communication interface. One or more of the steps of the methods described above may be performed when a software program is loaded into memory and executed by a processor. Alternatively, in other embodiments, the processor may be configured to perform one of the methods described above in any other suitable manner (e.g., by means of firmware).
Logic and/or steps represented in the flowcharts or otherwise described herein may be embodied in any readable storage medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions.
Those skilled in the art will appreciate that implementing all or part of the above-described methods in accordance with the embodiments may be accomplished by way of a computer program stored on a computer readable storage medium, which when executed may comprise the steps of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), or the like.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some of the technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (8)

1. A Python-based Web service and Socket client interaction system, the system comprising: an external web server, an internal server and a Socket client;
the internal server comprises a master control module, an internal web service module, a Socket service module, a bridging module and an http message sending module;
the bridging module comprises a global variable unit, a Socket client instance and an ID binding relation table, and a synchronous waiting handle and ID binding relation table;
the bridging module is a middle layer module for connecting the internal Web service module and the Socket service module and is used for realizing bridging conversion between the Web service and the Socket service;
the master control module is respectively in data interaction with the internal web service module and the Socket service module and is used for controlling the internal web service module and the Socket service module; the Socket service module is connected with the Socket client and performs data interaction; the internal web service module and the Socket service module are connected with the bridging module, so that bridging conversion between web service and Socket service is realized; the http message sending module receives message data from the Socket service module and sends the data to an external web server; the external web service end performs data interaction with the internal web service business module;
the steps of the bridge module in communication interaction between the external web server and the Socket client are as follows:
s1, an external web server sends a query request to an internal web service business module;
after the internal web service business module receives the query request of the external web service end, a corresponding Socket client end instance is found based on the unique ID in a Socket client end instance and ID binding relation table, and the query request is sent to the corresponding Socket client end through the Socket service business module;
s2, finding a corresponding synchronous waiting handle according to the unique ID in a synchronous waiting handle and ID binding relation table, and blocking to wait for a return result from a corresponding Socket client after sending a query request;
s3, if the corresponding Socket client returns a result to the Socket service module within a specified time, the internal Web service module ends the blocking state and returns result data to the external Web server;
if the corresponding Socket client does not return a result within the specified time, resetting the synchronous waiting handle, ending the blocking state by the internal Web service business module, and returning a timeout error message to the external Web server;
when there is a difference between the external web server and the Socket client protocol, in the step S1, the request initiated by the external web server carries the unique ID of one or more Socket clients in the transmitted data packet;
and the bridging module circularly sends a query request to the appointed Socket client based on the unique ID.
2. The system of claim 1, wherein the Socket client instance and ID binding table is configured to record a Socket client instance and a unique ID of a Socket client corresponding to the Socket client instance, and the Socket service module sends a query request based on the Socket client instance.
3. The system of claim 1, wherein the synchronization waiting handle and ID binding table is configured to store a synchronization waiting handle corresponding to a unique ID of the Socket client, where the synchronization waiting handle is configured to block waiting for a return result from the Socket client after the Socket service module sends a request.
4. The system of claim 1, wherein the global variable unit is configured to store global variables accessible by the internal web service traffic module and the Socket service traffic module.
5. A method for interaction between a Python-based Web service and a Socket client, the method comprising:
setting a bridging module in a server, wherein the bridging module comprises a global variable unit, a Socket client instance and an ID binding relation table, and a synchronous waiting handle and ID binding relation table; the bridging module realizes bridging conversion between the web service and the Socket service; the server side further comprises: an internal web service module, a Socket service module and an http message sending module;
the steps of the bridge module in communication interaction between the external web server and the Socket client are as follows:
s1, an external web server sends a query request to an internal web service business module;
after the internal web service business module receives the query request of the external web service end, a corresponding Socket client end instance is found based on the unique ID in a Socket client end instance and ID binding relation table, and the query request is sent to the corresponding Socket client end through the Socket service business module;
s2, finding a corresponding synchronous waiting handle according to the unique ID in a synchronous waiting handle and ID binding relation table, and blocking to wait for a return result from a corresponding Socket client after sending a query request;
s3, if the corresponding Socket client returns a result to the Socket service module within a specified time, the internal Web service module ends the blocking state and returns result data to the external Web server;
if the corresponding Socket client does not return a result within the specified time, resetting the synchronous waiting handle, ending the blocking state by the internal Web service business module, and returning a timeout error message to the external Web server;
when there is a difference between the external web server and the Socket client protocol, in the step S1, the request initiated by the external web server carries the unique ID of one or more Socket clients in the transmitted data packet;
and the bridging module circularly sends a query request to the appointed Socket client based on the unique ID.
6. The method of claim 5, wherein S3 further comprises, after the designated Socket client returns the result to the Socket service module, the Socket service module sequentially returns the result to the internal web service module through the bridge module, and the internal web service module sequentially encapsulates the returned result and the unique ID and returns the result to the external web service.
7. The method according to claim 5, wherein when the external web service terminal transmits broadcast data to the Socket client terminal, the transmitted broadcast data does not contain a unique ID of the Socket client terminal;
at this time, the bridging module notifies the Socket service module to send broadcast data to all Socket clients.
8. The method according to claim 5, wherein when the Socket client sends a request to the external Web server, the Socket service module generates a unique ID for the Socket client after establishing a connection with the Socket client;
the Socket business service module sends information of the Socket client to an external web service terminal, wherein the information of the Socket client comprises the newly generated unique ID.
CN202111613288.6A 2021-12-27 2021-12-27 Python-based Web service and Socket client interaction method and system Active CN114301891B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111613288.6A CN114301891B (en) 2021-12-27 2021-12-27 Python-based Web service and Socket client interaction method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111613288.6A CN114301891B (en) 2021-12-27 2021-12-27 Python-based Web service and Socket client interaction method and system

Publications (2)

Publication Number Publication Date
CN114301891A CN114301891A (en) 2022-04-08
CN114301891B true CN114301891B (en) 2023-10-13

Family

ID=80968864

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111613288.6A Active CN114301891B (en) 2021-12-27 2021-12-27 Python-based Web service and Socket client interaction method and system

Country Status (1)

Country Link
CN (1) CN114301891B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116501712A (en) * 2023-05-05 2023-07-28 北京睿芯高通量科技有限公司 Fine-grained storage service quality control implementation method

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101119392A (en) * 2007-08-21 2008-02-06 南京联创科技股份有限公司 SOCKET united access method
CN103139157A (en) * 2011-11-28 2013-06-05 北京南车时代信息技术有限公司 Network communication method based on socket, device and system
CN106844062A (en) * 2016-12-23 2017-06-13 华南师范大学 It is a kind of to realize the communication means that real time bidirectional is assisted in C++ and Python intermodules
CN107241425A (en) * 2017-06-26 2017-10-10 中国石油大学(华东) A kind of non-obstruction end hopping method based on Web service
CN107426233A (en) * 2017-08-08 2017-12-01 深圳先进技术研究院 Data communication system, method, Web server and monitoring system based on B/S frameworks
CN112398897A (en) * 2020-04-24 2021-02-23 江南大学 Wireless remote-controlled robot system design scheme based on Socket communication
CN112667419A (en) * 2021-01-04 2021-04-16 南京海兴电网技术有限公司 Multi-process communication method based on client server model

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012162397A1 (en) * 2011-05-23 2012-11-29 Twilio, Inc. System and method for connecting a communication to a client

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101119392A (en) * 2007-08-21 2008-02-06 南京联创科技股份有限公司 SOCKET united access method
CN103139157A (en) * 2011-11-28 2013-06-05 北京南车时代信息技术有限公司 Network communication method based on socket, device and system
CN106844062A (en) * 2016-12-23 2017-06-13 华南师范大学 It is a kind of to realize the communication means that real time bidirectional is assisted in C++ and Python intermodules
CN107241425A (en) * 2017-06-26 2017-10-10 中国石油大学(华东) A kind of non-obstruction end hopping method based on Web service
CN107426233A (en) * 2017-08-08 2017-12-01 深圳先进技术研究院 Data communication system, method, Web server and monitoring system based on B/S frameworks
CN112398897A (en) * 2020-04-24 2021-02-23 江南大学 Wireless remote-controlled robot system design scheme based on Socket communication
CN112667419A (en) * 2021-01-04 2021-04-16 南京海兴电网技术有限公司 Multi-process communication method based on client server model

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
基于事件驱动的高性能WebSocket服务器的设计与实现;曹文彬;谭新明;刘备;刘传文;;计算机应用与软件(01);第21-27页 *
张萍萍 ; 纪志坚 ; .基于Python的聊天软件的设计与实现.网络安全技术与应用.2017,(05),第27-33页. *

Also Published As

Publication number Publication date
CN114301891A (en) 2022-04-08

Similar Documents

Publication Publication Date Title
US20140323110A1 (en) Multipoint communication device and method of performing switching from multipoint communication to point-to-point communication
US10609125B2 (en) Method and system for transmitting communication data
US20110153581A1 (en) Method for Providing Connections for Application Processes to a Database Server
CN110808948B (en) Remote procedure calling method, device and system
US8527661B1 (en) Gateway for connecting clients and servers utilizing remote direct memory access controls to separate data path from control path
CN112631788B (en) Data transmission method and data transmission server
CN114301891B (en) Python-based Web service and Socket client interaction method and system
CN113301166A (en) Service calling method and device, storage medium and electronic device
CN113746928B (en) Cross-cloud service calling method, device and system
EP4210275A1 (en) Device cross-area access method and apparatus, electronic device, and storage medium
CN109327511A (en) A kind of data request method and server based on http protocol
CA3156410A1 (en) Method of and device for networking access of client ends in p2p system
CN102594886B (en) Method and device for direct communication between browsers, and communication system
US20220014887A1 (en) Methods providing service context transfer and related network nodes
CN111541662A (en) Communication method, device, system and equipment based on binary communication protocol
CN112511621B (en) Data transmission method and device, storage medium, and electronic device
CN111131470B (en) Terminal device, data processing method thereof and data processing system
CN113765867B (en) Data transmission method, device, equipment and storage medium
CN113765801B (en) Message processing method and device applied to data center, electronic equipment and medium
CN108959134B (en) Communication for field programmable gate array devices
CN115623057A (en) RDMA (remote direct memory Access) -based connection establishing method, device, equipment and storage medium
JP2019040579A (en) Message push system, client device and message push method therefor
CN112039801B (en) Method, system and proxy server for setting IP information
CN114860740A (en) Distributed transaction processing method, device and system based on programmable switch
CN113114670A (en) Multi-protocol connection method, equipment and storage medium of block chain network

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
CP01 Change in the name or title of a patent holder
CP01 Change in the name or title of a patent holder

Address after: Room 711c, 7 / F, block a, building 1, yard 19, Ronghua Middle Road, Beijing Economic and Technological Development Zone, Daxing District, Beijing 102600

Patentee after: Beijing Zhongke Flux Technology Co.,Ltd.

Address before: Room 711c, 7 / F, block a, building 1, yard 19, Ronghua Middle Road, Beijing Economic and Technological Development Zone, Daxing District, Beijing 102600

Patentee before: Beijing Ruixin high throughput technology Co.,Ltd.