CN110138858A - A kind of task management system and method based on Websocket - Google Patents
A kind of task management system and method based on Websocket Download PDFInfo
- Publication number
- CN110138858A CN110138858A CN201910399088.1A CN201910399088A CN110138858A CN 110138858 A CN110138858 A CN 110138858A CN 201910399088 A CN201910399088 A CN 201910399088A CN 110138858 A CN110138858 A CN 110138858A
- Authority
- CN
- China
- Prior art keywords
- task
- client
- server
- websocket
- sent
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/02—Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
- H04L67/141—Setup of application sessions
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
- H04L67/143—Termination or inactivation of sessions, e.g. event-controlled end of session
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
- H04L67/146—Markers for unambiguous identification of a particular session, e.g. session cookie or URL-encoding
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/16—Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
- H04L69/161—Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields
- H04L69/162—Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields involving adaptations of sockets based mechanisms
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Computer And Data Communications (AREA)
Abstract
The invention discloses a kind of task management system and method based on Websocket, comprising: task management interface module, for providing RESTful api interface, for adding, deletion task, query task executive condition to server;Task processing module, for handling logic to client addition task according to business demand;Websocket interface module, for establishing the connection relationship of server and client by Websocket agreement;Task is sent to client for secondary server, receives and sends the task action result sent by client to server.The present invention carries out network task management using Websocket agreement, sends and receives task or message by a connection, does not need client and re-establish connection, effectively improve task management efficiency.
Description
Technical field
The present invention relates to network task administrative skill fields, and in particular to a kind of task management system based on Websocket
System and method.
Background technique
In C/S (Client/Server) framework scene, realize that server publication is appointed by third party's message queue product
To client, third party's message queue product includes RabbitMQ, kafka, ZooKeeper etc., soft by these for business or message
Part, server is by mission dispatching to client, and client establishes new connection after completing task execution with server again, for returning
The implementing result for the task of returning.It should common task distributed architecture include in the process three kinds, the first is push mode, i.e., ought have and appoint
When business needs to issue, server is actively initiated and the connection of client, by mission dispatching;Second is pull-mode, i.e. client
Periodically connection server, whether the issuing oneself of the task in need otherwise waits for down if then the task of fetching starts to execute for inquiry
One query;The third is long poll, this mode be also initiated the connection by user end to server it is different with pull-mode
It is that, even if not needing to issue the task of client, connection is not also interrupted, when thering is task to need to issue client, service
Device returns again to data, and closes connection.
Above-mentioned three kinds of frameworks, push mode need client actively to open a port to be monitored, will increase client
Security risk, while if client behind the network equipments such as NAT, can not work;Although pull-mode avoids
The weakness of push mode, but need client that server is periodically gone to inquire, when there are many client terminal quantity, this frequent inquiry
It will increase the pressure of server;Long poll is improved on pull-mode, reduces many unnecessary inquiry request numbers,
But also need client initiated again after completing task execution one connect to server return implementing result.To sum up, existing
Lack a kind of network task management method of long connection mode in technology.
Summary of the invention
For above-mentioned defect in the prior art, the present invention provide a kind of task management system based on Websocket and
Method, under C/S model, server to wait client to complete to appoint to specified one or more client release tasks
Returning the result after business execution.
The present invention specifically includes:
A kind of task management system based on Websocket, comprising:
Task management interface module for adding, deletion task, is looked into for providing RESTful api interface to server
Ask task execution situation;
Task processing module, for handling logic to client addition task according to business demand;For example, for
The client of execution task can just issue new task after current task executes;
Websocket interface module, for establishing the connection relationship of server and client by Websocket agreement;
Task is sent to client for secondary server, receives and sends the task action result sent by client to server;
The server and client side all can be multiple.
It further, further include data memory module, the data memory module is counted with the task processing module
According to docking, the task processing module carries out data with the Websocket interface module and docks, specifically:
In the Websocket interface module to before client transmission task, the task processing module described will first appoint
Business is saved into the data memory module, then the task is sent to the Websocket interface module;
The Websocket interface module receives and sends the same of the task action result sent by client to server
When, the task action result is sent to the task processing module, then execute knot for described by the task processing module
Fruit is saved into the data memory module;
The data memory module, which is based on MySQL database, all can first be saved in data before each mission dispatching
Library, so times for having collected but not issued can be obtained from database when there is service or Server Restart
Business, is retransmitted, and ensure that the lasting and persistence of task processes.
Further, when task being sent to client by the Websocket interface module, the Websocket
Interface module is also used to:
Judge whether the client is connect with the server normal, if being then transmitted directly to the task described
Client;
Otherwise after monitoring the client and normally connecting with the server, the transmission of Xiang Suoshu task processing module is looked into
Ask the request of task to be sent, and receive the inquiry data returned by the task processing module, according to the inquiry data to
The client sends task;
The inquiry data are the pending task of the client, by the task processing module according to the inquiry to
The request of transmission task, inquiry obtains in the data memory module;
Due to that can be saved in the database before mission dispatching, so if client is offline, but there are task needs to give
When, task will not lose, and after client is connect with server again, can inquire task to be issued in the database and carry out again
It issues, it is ensured that task is normally sent to.
It further, further include executing time monitoring module, which can individually dispose, may alternatively be integrated at the task
It manages in module, is specifically used for:
After task is sent to client by the Websocket interface module, start timing, described in judgement
Whether Websocket interface module has received the task action result sent by the client within a preset time, if
Then close timing;Otherwise it is considered as the client executing task time-out, and feeds back time-out information to the task processing module;
Some tasks may could return to implementing result or client in the client executing long period and appoint in execution
It can restart during business, so needing that time-out time is arranged to task execution, handle time-out further according to concrete condition and setting
Task, such as continue waiting for or re-issue.
Further, further include authentication module, for receiving the registration request of client transmission, and be client point
Authentication with unique identifier, when the identifier is connect for client with server;
Or the connection status for monitor client and server, same mark is used when monitoring at least two clients
When symbol is connect with server, whether effectively corresponding connection is verified using Ping/Pong message package, if so, respectively to corresponding
Client sends the message re-registered;Otherwise invalid connection is deleted;
It in task management, needs to identify each client, is just able to achieve to specified client and sends task, usually
It needs client during installation to server registration, distributes a unique identifier respectively for each client;In reality
In application scenarios, often has client and use cloning system, the striking resemblances such as configuration information after clone in client will
There is the case where multiple client is attached using same identifier, sends the letter re-registered to corresponding each client at this time
Breath can miss security risk caused by hair or task leakage to avoid task;Meanwhile client because the reasons such as network problem interrupt with
When the connection of server, server may not be able to detect that connection has been interrupted at the first time, but client has detected that interruption simultaneously
Reconnect, at this moment also will appear the case where multiple client is attached using same identifier in server side, but with it is upper
Unlike the case where face is cloned, only one connection is effective at this time;Both of these case is comprehensively considered, monitoring is worked as
When being connect to multiple client using same identifier with server, whether effectively connection is first judged, then decide whether to send
Information is re-registered, sufficiently solves the problems, such as to repeat client, improves the safety of task management.
A kind of task management method based on Websocket, comprising:
Server is attached with client by Websocket agreement;
The server is managed task by RESTful api interface;
The server sends pending task to the client by Websocket interface, and according to business demand,
Logic is handled to client addition task;For example, terminating for the client for being carrying out task in current task execution
New task can be just issued afterwards;
The task action result that the server is sent by the Websocket interface by the client;
It is described that task is managed by RESTful api interface, comprising: task is deleted in addition, and query task executes
Situation;The server and client side all can be multiple.
Further, it before the server sends pending task to the client by Websocket interface, also wraps
It includes:
The pending task is deposited into database;
The task action result that the server is sent by the Websocket interface by the client it is same
When, the method also includes:
The implementing result is deposited into the database;
The data memory module, which is based on MySQL database, all can first be saved in data before each mission dispatching
Library, so times for having collected but not issued can be obtained from database when there is service or Server Restart
Business, is retransmitted, and ensure that the lasting and persistence of task processes.
Further, it when the server sends pending task to the client by Websocket interface, also wraps
It includes:
Judge whether the client is connect with the server normal, if then directly transmitting the pending task
To the client;
Otherwise after monitoring the client and normally connecting with the server, it is pending that Xiang Suoshu database sends inquiry
The request of task is sent, receives the task to be sent returned by the database, and the task to be sent is sent to the visitor
Family end;
Due to that can be saved in the database before mission dispatching, so if client is offline, but there are task needs to give
When, task will not lose, and after client is connect with server again, can inquire task to be issued in the database and carry out again
It issues, it is ensured that task is normally sent to.
Further, it after the server sends pending task to the client by Websocket interface, also wraps
It includes:
Start timing according to preset time, judges the server whether within a preset time by the Websocket
Interface is to the task action result sent by the client, if then closing timing;Otherwise it is considered as the client
Execution task time-out, and return to time-out information;
Some tasks may could return to implementing result or client in the client executing long period and appoint in execution
It can restart during business, so needing that time-out time is arranged to task execution, handle time-out further according to concrete condition and setting
Task, such as continue waiting for or re-issue.
Further, when server and client are attached by Websocket agreement, further includes:
The server receives the registration request that the client is sent, and distributes unique identifier, institute for the client
State authentication when identifier is connect for the client with the server;
Or the connection status of the monitoring server and the client, when monitor at least two clients use it is same
When identifier is connect with the server, whether effectively corresponding connection is verified using Ping/Pong message package, if so, point
The message re-registered is not sent to relative client;Otherwise invalid connection is deleted;
It in task management, needs to identify each client, is just able to achieve to specified client and sends task, usually
It needs client during installation to server registration, distributes a unique identifier respectively for each client;In reality
In application scenarios, often has client and use cloning system, the striking resemblances such as configuration information after clone in client will
There is the case where multiple client is attached using same identifier, sends the letter re-registered to corresponding each client at this time
Breath can miss security risk caused by hair or task leakage to avoid task;Meanwhile client because the reasons such as network problem interrupt with
When the connection of server, server may not be able to detect that connection has been interrupted at the first time, but client has detected that interruption simultaneously
Reconnect, at this moment also will appear the case where multiple client is attached using same identifier in server side, but with it is upper
Unlike the case where face is cloned, only one connection is effective at this time;Both of these case is comprehensively considered, monitoring is worked as
When being connect to multiple client using same identifier with server, whether effectively connection is first judged, then decide whether to send
Information is re-registered, sufficiently solves the problems, such as to repeat client, improves the safety of task management.
The beneficial effects of the present invention are embodied in:
The present invention carries out network task management using Websocket agreement, and Websocket agreement can establish long connection,
Task or message are sent and received by a connection, client is not needed and re-establishes connection, improve task management efficiency
While, dynamic follow-up effectively can be carried out to task execution process, understand task execution situation in real time.Further, of the invention
It solves task persistence, client off-line processing, overtime task processing, repeat the problems such as client connection, be network task
Management provides comprehensive solution.Meanwhile and directly using unlike TCP, HTTP (S) agreement can be used in Websocket,
Make the present invention be easier to dispose in practical applications, does not need to open the additional port other than HTTP (S).
Detailed description of the invention
It, below will be to specific in order to illustrate more clearly of the specific embodiment of the invention or technical solution in the prior art
Embodiment or attached drawing needed to be used in the description of the prior art are briefly described.In all the appended drawings, similar element
Or part is generally identified by similar appended drawing reference.In attached drawing, each element or part might not be drawn according to actual ratio.
Fig. 1 is a kind of task management system structure chart based on Websocket of the embodiment of the present invention;
Fig. 2 is task management system structure chart of the another kind of the embodiment of the present invention based on Websocket;
Fig. 3 is a kind of task management method flow chart based on Websocket of the embodiment of the present invention.
Specific embodiment
It is described in detail below in conjunction with embodiment of the attached drawing to technical solution of the present invention.Following embodiment is only used for
Clearly illustrate technical solution of the present invention, therefore be only used as example, and cannot be used as a limitation and limit protection model of the invention
It encloses.
It should be noted that unless otherwise indicated, technical term or scientific term used in this application should be this hair
The ordinary meaning that bright one of ordinary skill in the art are understood.
As shown in Figure 1, for a kind of task management system embodiment based on Websocket of the present invention, comprising:
Task management interface module 11, for providing RESTful api interface to server, for adding, deletion task,
Query task executive condition;
Task processing module 12, for handling logic to client addition task according to business demand;For example, for just
In the client of the task of execution, new task can be just issued after current task executes;
Websocket interface module 13, the connection for establishing server and client by Websocket agreement are closed
System;Task is sent to client for secondary server, receives and sends the task execution knot sent by client to server
Fruit;
The server and client side all can be multiple.
Preferably, as shown in Fig. 2, further including data memory module 14, at the data memory module 14 and the task
It manages module 12 and carries out data docking, the task processing module 12 carries out data with the Websocket interface module 13 and docks,
Specifically:
In the Websocket interface module 13 to before client transmission task, the task processing module 12 first will be from
The task that the task management interface module 11 obtains is saved into the data memory module 14, then the task is sent to institute
State Websocket interface module 13;
The Websocket interface module 13 receives and sends the task action result sent by client to server
Meanwhile the task action result is sent to the task processing module 12, then will be described by the task processing module 12
Implementing result is saved into the data memory module 14, while the implementing result is sent to institute by the task processing module 12
Task management interface module 11 is stated, the implementing result is returned into the server by the task management interface module 11;
The data memory module 14, which is based on MySQL database, all can first be saved in number before each mission dispatching
According to library, so when there is service or Server Restart, it can be obtained from database and collect but do not issued
Task is retransmitted, and ensure that the lasting and persistence of task processes.
Preferably, when task being sent to client by the Websocket interface module 13, the Websocket
Interface module 13 is also used to:
Judge whether the client is connect with the server normal, if being then transmitted directly to the task described
Client;
Otherwise after monitoring the client and normally connecting with the server, Xiang Suoshu task processing module 12 is sent
The request of task to be sent is inquired, and receives the inquiry data returned by the task processing module 12, according to the inquiry number
Task is sent according to the client;
The inquiry data are the pending task of the client, by the task processing module 12 according to the inquiry
The request of task to be sent, inquiry obtains in the data memory module 14;
Due to that can be saved in the database before mission dispatching, so if client is offline, but there are task needs to give
When, task will not lose, and after client is connect with server again, can inquire task to be issued in the database and carry out again
It issues, it is ensured that task is normally sent to.
It preferably, further include executing time monitoring module, which can individually dispose, and may alternatively be integrated within the task processing
In module 12, it is specifically used for:
After task is sent to client by the Websocket interface module 13, start timing, described in judgement
Whether Websocket interface module 13 has received the task action result sent by the client within a preset time, if
It is to close timing;Otherwise it is considered as the client executing task time-out, and feeds back overtime letter to the task processing module 12
Breath;
Some tasks may could return to implementing result or client in the client executing long period and appoint in execution
It can restart during business, so needing that time-out time is arranged to task execution, handle time-out further according to concrete condition and setting
Task, such as continue waiting for or re-issue.
Preferably, further include authentication module, distributed for receiving the registration request of client transmission, and for client
Unique identifier, the authentication when identifier is connect for client with server;
Or the connection status for monitor client and server, same mark is used when monitoring at least two clients
When symbol is connect with server, whether effectively corresponding connection is verified using Ping/Pong message package, if so, respectively to corresponding
Client sends the message re-registered;Otherwise invalid connection is deleted;
It in task management, needs to identify each client, is just able to achieve to specified client and sends task, usually
It needs client during installation to server registration, distributes a unique identifier respectively for each client;In reality
In application scenarios, often has client and use cloning system, the striking resemblances such as configuration information after clone in client will
There is the case where multiple client is attached using same identifier, sends the letter re-registered to corresponding each client at this time
Breath can miss security risk caused by hair or task leakage to avoid task;Meanwhile client because the reasons such as network problem interrupt with
When the connection of server, server may not be able to detect that connection has been interrupted at the first time, but client has detected that interruption simultaneously
Reconnect, at this moment also will appear the case where multiple client is attached using same identifier in server side, but with it is upper
Unlike the case where face is cloned, only one connection is effective at this time;Both of these case is comprehensively considered, monitoring is worked as
When being connect to multiple client using same identifier with server, whether effectively connection is first judged, then decide whether to send
Information is re-registered, sufficiently solves the problems, such as to repeat client, improves the safety of task management.
As shown in figure 3, for a kind of task management method embodiment based on Websocket of the present invention, comprising:
S31: server is attached with client by Websocket agreement;
S32: the server is managed task by RESTful api interface;
S33: the server sends pending task to the client by Websocket interface, and according to business
Demand, Xiang Suoshu client add task and handle logic;For example, being held for the client for being carrying out task in current task
New task can be just issued after row;
S34: the task execution knot that the server is sent by the Websocket interface by the client
Fruit;
It is described that task is managed by RESTful api interface, comprising: task is deleted in addition, and query task executes
Situation;The server and client side all can be multiple.
Preferably, it before the server sends pending task to the client by Websocket interface, also wraps
It includes:
The pending task is deposited into database;
The task action result that the server is sent by the Websocket interface by the client it is same
When, the method also includes:
The implementing result is deposited into the database;
The data memory module, which is based on MySQL database, all can first be saved in data before each mission dispatching
Library, so times for having collected but not issued can be obtained from database when there is service or Server Restart
Business, is retransmitted, and ensure that the lasting and persistence of task processes.
Preferably, it when the server sends pending task to the client by Websocket interface, also wraps
It includes:
Judge whether the client is connect with the server normal, if then directly transmitting the pending task
To the client;
Otherwise after monitoring the client and normally connecting with the server, it is pending that Xiang Suoshu database sends inquiry
The request of task is sent, receives the task to be sent returned by the database, and the task to be sent is sent to the visitor
Family end;
Due to that can be saved in the database before mission dispatching, so if client is offline, but there are task needs to give
When, task will not lose, and after client is connect with server again, can inquire task to be issued in the database and carry out again
It issues, it is ensured that task is normally sent to.
Preferably, it after the server sends pending task to the client by Websocket interface, also wraps
It includes:
Start timing according to preset time, judges the server whether within a preset time by the Websocket
Interface is to the task action result sent by the client, if then closing timing;Otherwise it is considered as the client
Execution task time-out, and return to time-out information;
Some tasks may could return to implementing result or client in the client executing long period and appoint in execution
It can restart during business, so needing that time-out time is arranged to task execution, handle time-out further according to concrete condition and setting
Task, such as continue waiting for or re-issue.
Preferably, when server and client are attached by Websocket agreement, further includes:
The server receives the registration request that the client is sent, and distributes unique identifier, institute for the client
State authentication when identifier is connect for the client with the server;
Or the connection status of the monitoring server and the client, when monitor at least two clients use it is same
When identifier is connect with the server, whether effectively corresponding connection is verified using Ping/Pong message package, if so, point
The message re-registered is not sent to relative client;Otherwise invalid connection is deleted;
It in task management, needs to identify each client, is just able to achieve to specified client and sends task, usually
It needs client during installation to server registration, distributes a unique identifier respectively for each client;In reality
In application scenarios, often has client and use cloning system, the striking resemblances such as configuration information after clone in client will
There is the case where multiple client is attached using same identifier, sends the letter re-registered to corresponding each client at this time
Breath can miss security risk caused by hair or task leakage to avoid task;Meanwhile client because the reasons such as network problem interrupt with
When the connection of server, server may not be able to detect that connection has been interrupted at the first time, but client has detected that interruption simultaneously
Reconnect, at this moment also will appear the case where multiple client is attached using same identifier in server side, but with it is upper
Unlike the case where face is cloned, only one connection is effective at this time;Both of these case is comprehensively considered, monitoring is worked as
When being connect to multiple client using same identifier with server, whether effectively connection is first judged, then decide whether to send
Information is re-registered, sufficiently solves the problems, such as to repeat client, improves the safety of task management.
The present invention carries out network task management using Websocket agreement, and Websocket agreement can establish long connection,
Task or message are sent and received by a connection, client is not needed and re-establishes connection, improve task management efficiency
While, dynamic follow-up effectively can be carried out to task execution process, understand task execution situation in real time.Further, of the invention
It solves task persistence, client off-line processing, overtime task processing, repeat the problems such as client connection, be network task
Management provides comprehensive solution.Meanwhile and directly using unlike TCP, HTTP (S) agreement can be used in Websocket,
Make the present invention be easier to dispose in practical applications, does not need to open the additional port other than HTTP (S).
Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention., rather than its limitations;To the greatest extent
Pipe present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that: its according to
So be possible to modify the technical solutions described in the foregoing embodiments, or to some or all of the technical features into
Row equivalent replacement;And these are modified or replaceed, various embodiments of the present invention technology that it does not separate the essence of the corresponding technical solution
The range of scheme should all cover within the scope of the claims and the description of the invention.
Claims (10)
1. a kind of task management system based on Websocket characterized by comprising
Task management interface module, for providing RESTful api interface to server, for adding, deletion task, inquiry is appointed
Business executive condition;
Task processing module, for handling logic to client addition task according to business demand;
Websocket interface module, for establishing the connection relationship of server and client by Websocket agreement;For
Secondary server sends task to client, receives and sends the task action result sent by client to server.
2. the system as claimed in claim 1, which is characterized in that further include data memory module, the data memory module with
The task processing module carries out data docking, and the task processing module and the Websocket interface module carry out data
Docking, specifically:
In the Websocket interface module to before client transmission task, the task processing module first protects the task
The data memory module is deposited into, then the task is sent to the Websocket interface module;
While the Websocket interface module receives and sends the task action result sent by client to server,
The task action result is sent to the task processing module, then is protected the implementing result by the task processing module
Deposit into the data memory module.
3. system as claimed in claim 2, which is characterized in that be sent to task by the Websocket interface module
When client, the Websocket interface module is also used to:
Judge whether the client is connect with the server normal, if the task is then transmitted directly to the client
End;
Otherwise after monitoring the client and normally being connect with the server, Xiang Suoshu task processing module send inquiry to
The request of transmission task, and receive the inquiry data that are returned by the task processing module, according to the inquiry data to described
Client sends task;
The inquiry data are the pending task of the client, to be sent according to the inquiry by the task processing module
The request of task, inquiry obtains in the data memory module.
4. system as claimed in claim 3, which is characterized in that further include executing time monitoring module, be specifically used for:
After task is sent to client by the Websocket interface module, starts timing, judge that the Websocket connects
Whether mouth mold block has received the task action result sent by the client within a preset time, if then closing timing;
Otherwise it is considered as the client executing task time-out, and feeds back time-out information to the task processing module.
5. system as claimed in claim 4, which is characterized in that further include authentication module, sent for receiving client
Registration request, and for client distribute unique identifier, the identifier for client connect with server when identity
Verifying;
Or the connection status for monitor client and server, when monitor at least two clients using same identifier with
When server connects, whether effectively corresponding connection is verified using Ping/Pong message package, if so, respectively to respective client
End sends the message re-registered;Otherwise invalid connection is deleted.
6. a kind of task management method based on Websocket characterized by comprising
Server is attached with client by Websocket agreement;
The server is managed task by RESTful api interface;
The server sends pending task to the client by Websocket interface, and according to business demand, to institute
State client addition task processing logic;
The task action result that the server is sent by the Websocket interface by the client;
It is described that task is managed by RESTful api interface, comprising: task is deleted in addition, and query task executes feelings
Condition.
7. method as claimed in claim 6, which is characterized in that the server passes through Websocket interface to the client
Before end sends pending task, the method also includes:
The pending task is deposited into database;
While the task action result that the server is sent by the Websocket interface by the client,
The method also includes:
The implementing result is deposited into the database.
8. the method for claim 7, which is characterized in that the server passes through Websocket interface to the client
When end sends pending task, the method also includes:
Judge whether the client is connect with the server normal, if the pending task is then transmitted directly to institute
State client;
Otherwise after monitoring the client and normally connecting with the server, Xiang Suoshu database sends to be sent of inquiry
The request of business receives the task to be sent returned by the database, and the task to be sent is sent to the client.
9. method according to claim 8, which is characterized in that the server passes through Websocket interface to the client
After end sends pending task, the method also includes:
Start timing according to preset time, judges the server whether within a preset time by the Websocket interface
The task action result sent by the client is had received, if then closing timing;Otherwise it is considered as the client executing
Task time-out, and return to time-out information.
10. method as claimed in claim 9, which is characterized in that server is connected with client by Websocket agreement
When connecing, the method also includes:
The server receives the registration request that the client is sent, and distributes unique identifier, the mark for the client
Know authentication when symbol is connect for the client with the server;
Or the connection status of the monitoring server and the client, same mark is used when monitoring at least two clients
Symbol is with the server when connect, verified using Ping/Pong message package accordingly connect it is whether effective, if so, respectively to
Relative client sends the message re-registered;Otherwise invalid connection is deleted.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910399088.1A CN110138858A (en) | 2019-05-14 | 2019-05-14 | A kind of task management system and method based on Websocket |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910399088.1A CN110138858A (en) | 2019-05-14 | 2019-05-14 | A kind of task management system and method based on Websocket |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110138858A true CN110138858A (en) | 2019-08-16 |
Family
ID=67573983
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910399088.1A Pending CN110138858A (en) | 2019-05-14 | 2019-05-14 | A kind of task management system and method based on Websocket |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110138858A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111949918A (en) * | 2020-08-23 | 2020-11-17 | 云知声智能科技股份有限公司 | Websocket connection optimization method and system based on distributed environment |
CN112671634A (en) * | 2020-12-21 | 2021-04-16 | 中电福富信息科技有限公司 | Websocket-based engineering field management communication method |
CN114598689A (en) * | 2022-03-08 | 2022-06-07 | 深圳市火火兔智慧科技有限公司 | Interactive method and device of IOT (input/output) equipment, computer equipment and storage medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9137288B2 (en) * | 2010-12-20 | 2015-09-15 | Yahoo! Inc. | Scalable push-based architecture for web applications |
CN105577605A (en) * | 2014-10-09 | 2016-05-11 | 阿尔卡特朗讯 | Method and server for adopting two-way REST based on WebSocket protocol in web real-time communication |
CN106713497A (en) * | 2017-01-24 | 2017-05-24 | 郑州云海信息技术有限公司 | Server-side message push device and method and message push system |
CN109361770A (en) * | 2018-12-11 | 2019-02-19 | 苏州创旅天下信息技术有限公司 | The system and method for bidirectional real-time is realized based on WebSocket and message queue |
CN109660617A (en) * | 2018-12-18 | 2019-04-19 | 中电科华云信息技术有限公司 | A kind of information push method based on server cluster |
-
2019
- 2019-05-14 CN CN201910399088.1A patent/CN110138858A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9137288B2 (en) * | 2010-12-20 | 2015-09-15 | Yahoo! Inc. | Scalable push-based architecture for web applications |
CN105577605A (en) * | 2014-10-09 | 2016-05-11 | 阿尔卡特朗讯 | Method and server for adopting two-way REST based on WebSocket protocol in web real-time communication |
CN106713497A (en) * | 2017-01-24 | 2017-05-24 | 郑州云海信息技术有限公司 | Server-side message push device and method and message push system |
CN109361770A (en) * | 2018-12-11 | 2019-02-19 | 苏州创旅天下信息技术有限公司 | The system and method for bidirectional real-time is realized based on WebSocket and message queue |
CN109660617A (en) * | 2018-12-18 | 2019-04-19 | 中电科华云信息技术有限公司 | A kind of information push method based on server cluster |
Non-Patent Citations (1)
Title |
---|
丁磊: "基于Websocket的消息推送系统设计与事件匹配技术研究", 《中国优秀硕士学位论文全文数据库信息科技辑》 * |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111949918A (en) * | 2020-08-23 | 2020-11-17 | 云知声智能科技股份有限公司 | Websocket connection optimization method and system based on distributed environment |
CN111949918B (en) * | 2020-08-23 | 2024-03-08 | 云知声智能科技股份有限公司 | Websocket connection optimization method and system based on distributed environment |
CN112671634A (en) * | 2020-12-21 | 2021-04-16 | 中电福富信息科技有限公司 | Websocket-based engineering field management communication method |
CN114598689A (en) * | 2022-03-08 | 2022-06-07 | 深圳市火火兔智慧科技有限公司 | Interactive method and device of IOT (input/output) equipment, computer equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110138858A (en) | A kind of task management system and method based on Websocket | |
EP1619855B1 (en) | System and method for managing and checking socket connections between a server and clients. | |
CN102209047B (en) | Instant messaging system and method for realizing information sharing | |
CN105120005B (en) | A kind of hot update method of game server, server and system | |
CN107592215A (en) | A kind of method for managing message-oriented middleware | |
CN101009649A (en) | Queue management in a network processor | |
CN109766201A (en) | Task distribution method, server, client and system | |
CN109491895A (en) | Server stress test method and device | |
CN105046802A (en) | Multi-counter based bank queuing and number calling method and system | |
US8787213B2 (en) | Correlating calls after a referral | |
US11677876B2 (en) | Techniques for sharing control of assigning tasks between an external pairing system and a task assignment system with an internal pairing system | |
CN106231235B (en) | Long-distance video meets with method and system under a kind of constrained environment | |
Zato et al. | Platform for building large-scale agent-based systems | |
CN104243473B (en) | A kind of method and device of data transmission | |
CN109474670A (en) | A kind of information interacting method and system | |
WO2012159537A1 (en) | Instant messaging system and method for sharing user information | |
CN102209049A (en) | Instant messaging system and method for user information processing | |
CN105335362B (en) | The processing method and system of real time data, instant disposal system for treating | |
CN103618665A (en) | Method for pushing messages to client | |
CN106102126B (en) | A kind of connection control method and device | |
CN103563305A (en) | System and method for providing push service to reduce network load | |
CN109471745A (en) | Delay machine server task processing method and system based on server cluster | |
CN104714783A (en) | Task processing method and device | |
CN107291383A (en) | The data interactive method and server of a kind of embedded device | |
CN109450870A (en) | Treating method and apparatus, storage medium and the electronic device of VOIP business |
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 | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20190816 |