CN114301891A - 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 PDFInfo
- Publication number
- CN114301891A CN114301891A CN202111613288.6A CN202111613288A CN114301891A CN 114301891 A CN114301891 A CN 114301891A CN 202111613288 A CN202111613288 A CN 202111613288A CN 114301891 A CN114301891 A CN 114301891A
- Authority
- CN
- China
- Prior art keywords
- socket
- module
- web service
- client
- service
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 28
- 230000003993 interaction Effects 0.000 title claims abstract description 23
- 230000001360 synchronised effect Effects 0.000 claims abstract description 30
- 230000006854 communication Effects 0.000 claims abstract description 26
- 238000004891 communication Methods 0.000 claims abstract description 25
- 230000000903 blocking effect Effects 0.000 claims description 14
- 238000006243 chemical reaction Methods 0.000 claims description 5
- 230000002452 interceptive effect Effects 0.000 claims description 2
- 230000004044 response Effects 0.000 abstract description 13
- 230000008569 process Effects 0.000 description 9
- 230000015654 memory Effects 0.000 description 5
- 238000011161 development Methods 0.000 description 4
- 230000007246 mechanism Effects 0.000 description 4
- 238000010586 diagram Methods 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 238000012545 processing Methods 0.000 description 3
- 230000005540 biological transmission Effects 0.000 description 2
- 230000002093 peripheral effect Effects 0.000 description 2
- 238000004590 computer program Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000000977 initiatory effect Effects 0.000 description 1
- 238000013507 mapping Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Abstract
The invention provides a Python-based Web service and Socket client interaction method and system, wherein the system comprises the following steps: the system comprises an external web server, an internal server and a Socket client; the internal server comprises a master control module, an internal web service business module, a Socket service business module, a bridging module and an http message sending module; the bridging module comprises a global variable unit, a Socket client instance and ID binding relation table and a synchronous waiting handle and ID binding relation table; the bridging module is an intermediate layer module which connects 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, long response time and the like of multiple clients.
Description
Technical Field
The invention relates to the field of server data interaction and data processing, in particular to a method and a system for interaction between a Web service and a Socket client based on Python.
Background
The Web services include Websocket and http services, and the Socket services include tcp and udp services. The Python can be used for Web service development and Socket service development, and at present, Python mature Web application frameworks comprise flash, Django, Tornado and the like.
In the currently used mode of connecting the web server and the socket client in the market, the following potential problems exist:
1. at present, an external Web service and a Socket client can be developed in any language, so that the service between different development languages needs to establish convenient connection, cross-platform requirements exist, and direct service connection cannot be carried out;
2. the external Web service can inquire information from one or more specified Socket clients, and generally under the condition, the response result is either an overtime return error or waits for the response data of the specified Socket client to perform the next data interaction;
3. in some specific requirements, it is required that an external Web service can push messages to all Socket clients and does not require a response;
4. the Socket client can request data from the external Web service, with the result either being a timeout returning error or a response waiting for the external Web service.
Therefore, a server needs to be designed to serve external Web services and a Socket client group respectively, so that the potential requirements can be realized simultaneously, concurrent communication and synchronous communication between the Web services and the Socket clients can be realized, a communication waiting 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 chip interconnection multi-application effective mapping method 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: the system comprises 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 ID binding relation table and a synchronous waiting handle and ID binding relation table;
the bridging module is an intermediate layer module which connects 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 business module is connected with the Socket client and performs data interaction; the internal web service business module and the Socket service business module are connected with the bridging module, so that bridging conversion between the web service and the 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; and the external web service end performs data interaction with the internal web service business module.
Preferably, the Socket client instance and ID binding relationship table is 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 arrangement is the basis for ensuring that an external web server can communicate with multiple Socket clients, either in a designated or parallel fashion.
Preferably, the synchronization waiting handle and ID binding relationship table is used to store a synchronization waiting handle corresponding to the unique ID of the Socket client, and the synchronization waiting handle is used to block and wait for a return result from the Socket client after the Socket service module sends a query request. The arrangement can ensure synchronous waiting communication, thereby effectively ensuring that the information sequence is not disordered.
Preferably, the global variable unit is used for storing global variables which can be accessed by the internal web service business module and the Socket service business 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 the 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 to be concerned by both Socket service and Web service, such as which Socket clients can upload data.
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 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: the system comprises an internal web service business module, a Socket service business module and an http message sending module;
the steps of the bridge module in the communication interaction between the external web server and the Socket client are as follows:
s1, the external web service terminal sends a query request to the internal web service business module;
after the internal web service business module receives a query request of an external web service terminal, finding a corresponding Socket client instance based on the unique ID in a Socket client instance and ID binding relation table, and sending the query request to a corresponding Socket client through the Socket service business module;
s2, finding the corresponding synchronous waiting handle according to the unique ID in the synchronous waiting handle and ID binding relation table, and blocking and waiting the return result from the corresponding Socket client after sending the query request;
s3, if the corresponding Socket client side returns the result to the Socket service business module within the specified time, the internal Web service business module ends the blocking state, and returns the result data to the external Web service side;
if the corresponding Socket client does not return the result within the specified time, resetting the synchronous waiting handle, ending the blocking state of the internal Web service module at the moment, and returning a timeout error message to the external Web service terminal.
Preferably, when the external web server and the Socket client have a difference in protocol, in S1, the query request initiated by the external web server carries the unique ID of one or more Socket clients in the sent data packet;
and the bridging module circularly sends a query request to a specified Socket client based on the unique ID. The messages are sent in a circulating mode, and the sequence of the messages can be guaranteed in a matching mode.
Preferably, the S3 further includes that, after the specified 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 encapsulated 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;
and at the moment, the bridging module informs 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.
And the Socket service module sends the information of the Socket client to an external web service terminal, wherein the information of the Socket client comprises a newly generated unique ID.
Preferably, for the unique ID generated for the Socket client, the ID and the connected Socket client instance are transferred to the bridge module, and a synchronous wait 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 a synchronous waiting handle into the synchronous waiting handle and ID binding relation table.
Preferably, during communication, the Socket client sends a request to the Socket service module, the Socket service module encapsulates the request message and the unique ID as a data packet, and sends the data packet to the external web service end by sending the http message 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 the request to the corresponding Socket client according to the real-time state of the Socket client; the global variable unit can also store policy configuration which needs to be concerned by Socket service and Web service, such as which Socket clients can upload data.
Compared with the prior art, the scheme of the invention supports concurrent communication of external Web service and multiple paths of different Socket clients; also supporting external Web services to communicate with a specified 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 ended until a response result or timeout occurs, and Web communication in the prior art is a stateless communication mechanism.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic structural diagram of a server according to an embodiment of the present invention;
FIG. 2 is a diagram of the overall architecture in data interaction according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating operation of the bridge module according to an embodiment of the present invention;
FIG. 4 is an interaction flowchart of an external Web service requesting data from a Socket client according to an embodiment of the present invention;
FIG. 5 is a flowchart of data interaction of an external Web service broadcasting a message to a Socket client according to an embodiment of the present invention;
fig. 6 is a schematic diagram of a process of a Socket client requesting a response to an external Web service according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without inventive effort based on the embodiments of the present invention, are within the scope of the present invention.
Referring to fig. 1 and fig. 2, in order to solve the problems in the prior art, in a specific embodiment, the structure of the server end added with the bridge module according to the present invention is configured as follows:
1. in order to realize concurrency of internal Web services, the invention selects a Python non-blocking Web service development architecture, such as flash + get;
2. in order to implement concurrency, Socket services (i.e., implemented by Socket service modules) need to establish Socket connections with each Socket client, and then create two python thread threads for reading and sending data respectively;
3. in order to enable the internal Web service and the Socket service to be interactive, a global bridging module can be developed based on a global technology of Python; the bridge module needs to implement at least the following functions:
(1) a global variable is maintained that is accessible to both services. 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 the policy configuration which needs to be concerned by both Socket service and Web service, such as which Socket clients can upload data;
(2) establishing a binding relation table between Socket client instances and IDs (identity) so that corresponding Socket clients can be found through the unique IDs;
(3) the synchronous waiting handle and the ID binding relation table, namely, each unique ID corresponds to one synchronous waiting handle.
In the whole system architecture, the system mainly includes an external web server, an internal server, and a socket client group, where the socket client group generally includes a plurality of clients, and certainly, the system may also be a special case that only includes one socket client.
The internal server side comprises a master control module, an internal web service business module, a socket service business module, a bridging module and an http message sending module. The master control module is used for controlling the internal web service business module and the socket service business module; the socket service business module is connected with a socket client and performs data interaction; the internal web service business module and the socket service business module are connected with the bridging module, so that bridging conversion of the web service and the socket service is realized; the external web service end and the internal web service business module perform data interaction, such as request sending and the like; and the http message sending module receives message data from the socket service business module and sends the data to an external web server.
In a more optimized embodiment, the bridge module contains a global variable unit, a socket client instance and ID binding relationship table, and a synchronization wait handle and ID binding relationship table.
And the Socket client instance and ID binding relation table is used for recording the Socket client instance and the unique ID of the Socket client corresponding to the Socket client instance, and the Socket service business module sends a query request based on the Socket client instance. This arrangement is the basis for ensuring that an external web server can communicate with multiple Socket clients, either in a designated or parallel fashion.
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 business module sends a query request. The arrangement can ensure synchronous waiting communication, thereby effectively ensuring that the information sequence is not disordered.
Based on the basic architecture setting of the system, detailed descriptions will be given below to specific processes in different communication scenarios based on the communication between the external web server and the Socket client, so as to describe a preferred implementation manner of the scheme of the present invention.
Firstly, an external Web server sends a message to a Socket client
The bridge module is a middle layer module which connects an internal Web service (i.e. realized by an internal Web service business module) and a Socket service. A general implementation flow of the bridge module in communication may be described with reference to fig. 3, taking an example that an external Web service sends a message to a Socket client, where the process is as follows:
1. after receiving an external Web service request, the internal Web service finds a unique corresponding Socket client instance according to an attached ID in a Socket client instance and ID binding relation table, and sends a query request in the Socket service;
2. finding the unique corresponding synchronous waiting handle according to the ID in the synchronous waiting handle and the ID binding relation table, and blocking and waiting for a return result from the Socket client after sending the query;
3. if the Socket client returns the result to the Socket service within the specified time, the Socket service resets the synchronous handle waiting state, the internal Web service finishes the blocking state, and returns the result data to the external Web service;
4. if the Socket client does not return the result within the specified time, the synchronous waiting handle is automatically reset, at the moment, the internal Web service ends the blocking state, and a timeout error message is returned to the external Web service.
Second, communication process from external Web service to Socket client
For the above flow, in a more detailed implementation manner, as shown in fig. 4, when there is a difference between protocols of the external web server and the Socket client, a query request initiated by the external web server carries unique IDs of one or more Socket clients in a sent data packet; and the bridging module circularly sends a query request to the specified Socket client based on the unique ID. After the specified Socket client side returns the result to the Socket service business module, the Socket service business module sequentially returns the result to the internal web service business module through the bridging module, and the internal web service business module sequentially encapsulates the returned result and the unique ID and then returns the result to the external web service side.
In the process of communication from the external Web service to the Socket client, the detailed service interaction process is as follows:
1. when the adopted protocols are different, the internal Web service can be Web socket service or http service according to the difference of the 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 the Socket service to circularly send a query request to a specified Socket client through the bridge module;
3. the Socket service sequentially sends query messages to a specified Socket client;
4. after the appointed Socket client receives the query messages successively, processing related services, and returning a result message to the Socket service;
5. the Socket service sequentially returns result data to the internal Web service through the bridge module;
6. and the internal Web service packs and encapsulates the result data and the ID into a json pack in sequence and returns the json pack 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 message sequence returned by the multiple concurrent requests can be ensured not to be disordered due to the use of a blocking synchronization mechanism.
Third, broadcast message to Socket client
Next, with reference to fig. 5, for another specific application scenario, that is, a scenario in which a message is broadcast 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; and at the moment, the bridging module informs the Socket service module to send broadcast data to all Socket clients. This is a special type of communication.
More specific communication processing flow is as follows:
1. the external web service sends broadcast data to the internal web service, and the json data packet of the sent broadcast data does not contain the ID of the Socket client;
2. after receiving the broadcast data, the internal web service informs Socket service to send the broadcast data to all Socket clients through the bridge module; at this time, more preferably, after receiving the message without the ID, the internal Web service may default to the broadcast message, and then notify the Socket service through the bridge module to send the broadcast message to all Socket clients;
3. and the Socket client receives the broadcast message to complete the transmission and reception 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.
Fourthly, the Socket client requests for external Web service
In addition, in another specific embodiment, when the Socket client requests the external Web service, the 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, the Socket service establishes connection when receiving the request, and generates a unique ID (such as UUID) for the Socket client, wherein the ID is a basis for identifying messages entering and exiting the Socket client; because the ID and the connected Socket client instance can be passed to the bridge module, a synchronous wait handle is created within the bridge module for the ID; 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 a synchronous waiting handle into the synchronous waiting handle and ID binding relation table. Then, the Socket service sends newly added Socket client information to the external Web service, wherein the Socket client information comprises the generated unique ID;
2. then, when communication is carried out, the Socket client sends a request to the Socket server, the Socket server (namely, a Socket service module) encapsulates a request message and a unique ID into a data packet, the data packet format can be a json format packet, for example, a http message sending module sends the json data packet to an external web service, and the response of the external web service is waited; note that the http message sending module has to select a non-blocking module, such as requests-futures of a third party open source; if the Python official requests module is used, the Socket server thread can be blocked, and the concurrency number processed by the Socket server is influenced.
3. After the external Web service is processed, returning a response result to the Socket service in a corresponding format, wherein the corresponding format refers to the format of a received data packet, for example, if the data packet in the json format is adopted in the previous step, the returned data packet is also returned to the Socket service in the corresponding json format;
the Socket service finds the 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 of the Socket client.
As above, the flow of the Socket client requesting communication to the external Web service is explained, and because a strict synchronization mechanism is used, the order of the request return messages can be ensured not to be disordered.
In yet another embodiment, the present solution can be implemented by means of a device, which can include corresponding modules for performing each or several steps in the above-mentioned respective embodiments. Thus, each step or several steps of the above-described embodiments may be performed by a respective module, and the electronic device may comprise one or more of these modules. The modules may be one or more hardware modules specifically configured to perform the respective steps, or implemented by a processor configured to perform the respective steps, or stored within a computer-readable medium for implementation by a processor, or 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) bus, a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one connection line is shown, but no single bus or type of bus is shown.
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 the scope of the preferred embodiments of the present disclosure includes other implementations 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 implementation of the present disclosure. The processor performs the various methods and processes described above. For example, method embodiments in the present scheme may be implemented as a software program tangibly embodied in a machine-readable medium, such as a memory. In some embodiments, some or all of the software program may be loaded and/or installed via memory and/or a communication interface. When the software program is loaded into memory and executed by a processor, one or more steps of the method described above may be performed. Alternatively, in other embodiments, the processor may be configured to perform one of the methods described above by any other suitable means (e.g., by means of firmware).
The 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.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes 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 (RAM), or the like.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.
Claims (10)
1. A Python-based Web service and Socket client interactive system is characterized in that the system comprises: the system comprises 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 ID binding relation table and a synchronous waiting handle and ID binding relation table;
the bridging module is an intermediate layer module which connects the internal Web service business module and the Socket service business module.
2. The system of claim 1, wherein the master control module performs data interaction with the internal web service module and the Socket service module respectively, and is configured to control the internal web service module and the Socket service module; the Socket service business module is connected with the Socket client and performs data interaction; the internal web service business module and the Socket service business module are connected with the bridging module, so that bridging conversion between the web service and the 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; and the external web service end performs data interaction with the internal web service business module.
3. The system according to claim 1, wherein the Socket client instance and ID binding relationship table is configured 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.
4. The system according to claim 1, wherein the synchronization waiting handle and ID binding relationship table is used to store a synchronization waiting handle corresponding to a unique ID of the Socket client, and the synchronization waiting handle is used to block and wait for a return result from the Socket client after the Socket service module sends a query request.
5. The system of claim 1, wherein the global variable unit is configured to store global variables that can be accessed by the internal web service business module and the Socket service business module.
6. A Python-based Web service and Socket client interaction method is characterized by comprising the following steps:
setting a bridging module in a server, wherein the bridging module comprises a global variable unit, a Socket client instance and 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: the system comprises an internal web service business module, a Socket service business module and an http message sending module;
the steps of the bridge module in the communication interaction between the external web server and the Socket client are as follows:
s1, the external web service terminal sends a query request to the internal web service business module;
after the internal web service business module receives a query request of an external web service terminal, finding a corresponding Socket client instance based on the unique ID in a Socket client instance and ID binding relation table, and sending the query request to a corresponding Socket client through the Socket service business module;
s2, finding the corresponding synchronous waiting handle according to the unique ID in the synchronous waiting handle and ID binding relation table, and blocking and waiting the return result from the corresponding Socket client after sending the query request;
s3, if the corresponding Socket client side returns the result to the Socket service business module within the specified time, the internal Web service business module ends the blocking state, and returns the result data to the external Web service side;
if the corresponding Socket client does not return the result within the specified time, resetting the synchronous waiting handle, ending the blocking state of the internal Web service module at the moment, and returning a timeout error message to the external Web service terminal.
7. The method according to claim 6, wherein when there is a difference between the external web server and the protocol of the Socket client, in S1, the query request initiated by the external web server carries the unique ID of one or more Socket clients in the sent data packet;
and the bridging module circularly sends a query request to a specified Socket client based on the unique ID.
8. The method of claim 7, wherein the S3 further includes that, after the specified Socket client returns the result to the Socket service business module, the Socket service business module sequentially returns the result to the internal web service business module through the bridge module, and the internal web service business module sequentially encapsulates the returned result and the unique ID and returns the encapsulated result to the external web service end.
9. The method of claim 6, wherein when the external web server sends the broadcast data to the Socket client, the sent broadcast data does not contain the unique ID of the Socket client;
and at the moment, the bridging module informs the Socket service module to send broadcast data to all Socket clients.
10. The method of claim 6, wherein when the Socket client sends a request to an external Web server, the Socket service module generates a unique ID for the Socket client after establishing connection with the Socket client;
and the Socket service module sends the information of the Socket client to an external web service terminal, wherein the information of the Socket client comprises a newly generated unique ID.
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 true CN114301891A (en) | 2022-04-08 |
CN114301891B 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) |
Cited By (1)
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 (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101119392A (en) * | 2007-08-21 | 2008-02-06 | 南京联创科技股份有限公司 | SOCKET united access method |
US20120304245A1 (en) * | 2011-05-23 | 2012-11-29 | Twilio, Inc. | System and method for connecting a communication to a client |
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 |
-
2021
- 2021-12-27 CN CN202111613288.6A patent/CN114301891B/en active Active
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101119392A (en) * | 2007-08-21 | 2008-02-06 | 南京联创科技股份有限公司 | SOCKET united access method |
US20120304245A1 (en) * | 2011-05-23 | 2012-11-29 | Twilio, Inc. | System and method for connecting a communication to a client |
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 (3)
Title |
---|
YUKI程序员: "python之socket编程", pages 2 - 7, Retrieved from the Internet <URL:https://blog.csdn.net/Yuki1127918/article/details/121383804> * |
张萍萍;纪志坚;: "基于Python的聊天软件的设计与实现", 网络安全技术与应用, no. 05, pages 27 - 33 * |
曹文彬;谭新明;刘备;刘传文;: "基于事件驱动的高性能WebSocket服务器的设计与实现", 计算机应用与软件, no. 01, pages 21 - 27 * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116501712A (en) * | 2023-05-05 | 2023-07-28 | 北京睿芯高通量科技有限公司 | Fine-grained storage service quality control implementation method |
Also Published As
Publication number | Publication date |
---|---|
CN114301891B (en) | 2023-10-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110430275B (en) | Data processing method, device, system, computing equipment and medium | |
US8898191B2 (en) | Method for providing connections for application processes to a database server | |
US4958278A (en) | Method for loading data or program to a plurality of terminal stations | |
CN108702486B (en) | Low-delay audio and video transmission method and device and computer readable storage medium | |
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 | |
US10609125B2 (en) | Method and system for transmitting communication data | |
US20230080588A1 (en) | Mqtt protocol simulation method and simulation device | |
CN114301891B (en) | Python-based Web service and Socket client interaction method and system | |
US11838381B2 (en) | Device cross-area access method, electronic device, and non-transitory computer-readable storage medium | |
CN109327511A (en) | A kind of data request method and server based on http protocol | |
CN115080479B (en) | Transmission method, server, device, bare metal instance and baseboard management controller | |
CN106803841B (en) | Method and device for reading message queue data and distributed data storage system | |
CN108959134B (en) | Communication for field programmable gate array devices | |
CN113765867B (en) | Data transmission method, device, equipment and storage medium | |
CN111131470B (en) | Terminal device, data processing method thereof and data processing system | |
US9092779B2 (en) | Heuristics processing | |
CN114860740A (en) | Distributed transaction processing method, device and system based on programmable switch | |
CN112822299A (en) | RDMA (remote direct memory Access) -based data transmission method and device and electronic equipment | |
CN112783675A (en) | IPC communication method | |
CN111901689A (en) | Streaming media data transmission method and device, terminal equipment and storage medium | |
CN111240845A (en) | Data processing method, device and storage medium | |
CN113726723B (en) | UDP-based data transmission method, device and equipment | |
CN114679435B (en) | Session management system, method, computer device and storage medium | |
CN112134735B (en) | Method and device for automatically expanding system |
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 |
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. |
|
CP01 | Change in the name or title of a patent holder |