CN110062055A - The method of distributed push is logged in single user based on websocket more - Google Patents
The method of distributed push is logged in single user based on websocket more Download PDFInfo
- Publication number
- CN110062055A CN110062055A CN201910467772.9A CN201910467772A CN110062055A CN 110062055 A CN110062055 A CN 110062055A CN 201910467772 A CN201910467772 A CN 201910467772A CN 110062055 A CN110062055 A CN 110062055A
- Authority
- CN
- China
- Prior art keywords
- message
- server
- websocket
- queue
- push
- 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
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/08—Network architectures or network communication protocols for network security for authentication of entities
-
- 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/50—Network services
- H04L67/55—Push-based network services
-
- 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
Abstract
The present invention proposes a kind of method for logging in distributed push the single user based on websocket more, belongs to information advancing technique field.The present invention solves the problems, such as the deficiency occurred during the push of current message and can not be adapted to some to special procure scene, its drip irrigation device are as follows: utilize message queue, and cache server is to the caching of user, when application backstage carries out message push, if it is pocket transmission news, message is pushed in the queue of all mass-sendings using the broadcast type interchanger and general mass-sending routing key stated;All websocket servers all listen to the pocket transmission news, send a message to all clients for being connected to itself websocket server at this time.The present invention both meets distributed deployment, supports that one key of containerization is disposed currently popular, keeps deployment more convenient, while being even more to meet same user after different places login, demand of all clients to PUSH message.
Description
Technical field
The present invention relates to information advancing techniques, in particular to logging in distribution the single user based on websocket more pushing away
The technology for the method sent.
Background technique
Information push refers to that client can receive the information of server end transmission automatically, and its purpose is to allow user to obtain
It to newest message and data, enables users to view up-to-date information in time, promotes user experience.Web pushes skill in real time at present
Art mainly uses two ways, and one is the method realizations using http poll, periodically sends http request to web server,
New data are waited to return, this method has compared with large overhead server and client side;Another way is to build
Websocket server, since websocket itself does not support distributed deployment, scalability is poor, and conventional uses kafka+
Although the scheme of redis can preferably accomplish to extend, increasing node every time needs to handle manually, and is more troublesome, in addition, same
User cannot be connected simultaneously to the websocket server when different places log in, and mostly log in single user support
Under scene, as logged in same user simultaneously on mobile phone and two computers, existing scheme can not solve very well.
Summary of the invention
The object of the present invention is to provide a kind of method for logging in distributed push single user based on websocket more,
It solves the problems, such as the deficiency occurred during the push of current message and can not be adapted to some to special procure scene.
The present invention solves its technical problem, the technical solution adopted is that: it being logged in the single user based on websocket point more
The method of cloth push, includes the following steps:
A. start websocket server, generate a multidigit random server id, add business using a specified prefix
Device id states a queue on message queue, and the queue and the prior publish-subscribe model interchanger stated are carried out
Binding, binding the routing key used is that specified prefix adds server id, while monitoring the queue just stated, in addition, thing
It first states a broadcast type interchanger, states that is mass-sended the queue used, the queue name for mass-sending the queue used is also
It using specified prefix plus the mode of server id, is bound using a general routing key and above-mentioned broadcast type interchanger, starting
It can be while listening for the queue that the mass-sending uses when websocket server;
B. client passes through application backstage progress user login operation, and after logging in, background service returns to a carrying and uses
Family id, i.e. uid's and validity period token;
C. client carries token by making long attended operation with websocket server after load balancing;
D.websocket server parses validity period and uid by token, carries out secondary place to the uid in validity period
Reason adds the random uuid of position, then plus server id, one new wsuid of formation, using the wsuid as client by uid
Id is connected, caching is established, meanwhile, key is done by uid in cache server, wsuid adds serverid to do value to be cached;
E. when application backstage carries out message push, if it is pocket transmission news, the broadcast type stated in step A is used
Message is pushed in the queue of all mass-sendings by interchanger and general mass-sending routing key;
F. all websocket servers all listen to the pocket transmission news, send a message to be connected to itself at this time
The all clients of websocket server, the message or a user can be received in different clients by completing all users
In the case of login, message can be received.
Particularly, in step A, the digit of the random server id is eight.
Further, the specified prefix is websocket.msg. in step A.
Particularly, in step D, the digit of the random uuid of the multidigit is eight.
Further, if the message of push is the push of designated user, being looked into redis by uid in step E
The wsuid and server id for asking all correspondence uid, using the publish-subscribe model interchanger stated in step A, according to
Message carrying wsuid is pushed to corresponding to the team that in column, websocket server will be different by monitoring by server id
Column receive only the message pushed needed for the wsuid of corresponding local server id, specify wsuid to be pushed to client message,
Same user is completed when different places log in, guarantees that all user clients receive corresponding message.
The invention has the advantages that by logging in distributed push the above-mentioned single user based on websocket more
Method both meets distributed deployment, supports that one key of containerization is disposed currently popular, keeps deployment more convenient, while being even more full
The same user of foot is after different places login, demand of all clients to PUSH message.
Specific embodiment
Below with reference to embodiment, the technical schemes of the invention are described in detail.
The method that distributed push is logged in single user of the present invention based on websocket, includes the following steps: more
A. start websocket server, generate a multidigit random server id, add business using a specified prefix
Device id states a queue on message queue, and the queue and the prior publish-subscribe model interchanger stated are carried out
Binding, binding the routing key used is that specified prefix adds server id, while monitoring the queue just stated, in addition, thing
It first states a broadcast type interchanger, states that is mass-sended the queue used, wherein the queue name for mass-sending the queue used is also
It using specified prefix plus the mode of server id, is bound using a general routing key and above-mentioned broadcast type interchanger, starting
It can be while listening for the queue that the mass-sending uses when websocket server.
B. client passes through application backstage progress user login operation, and after logging in, background service returns to a carrying and uses
Family id, i.e. uid's and validity period token.
C. client carries token by making long attended operation with websocket server after load balancing.
D.websocket server parses validity period and uid by token, carries out secondary place to the uid in validity period
Reason adds the random uuid of position, then plus server id, one new wsuid of formation, using the wsuid as client by uid
Id is connected, caching is established, meanwhile, key is done by uid in cache server, wsuid adds serverid to do value to be cached.
E. when application backstage carries out message push, if it is pocket transmission news, the broadcast type stated in step A is used
Message is pushed in the queue of all mass-sendings by interchanger and general mass-sending routing key.
F. all websocket servers all listen to the pocket transmission news, send a message to be connected to itself at this time
The all clients of websocket server, the message or a user can be received in different clients by completing all users
In the case of login, message can be received.
Embodiment one
The method that distributed push is logged in single user of the embodiment of the present invention based on websocket more, including walk as follows
It is rapid:
A. start websocket server, generate eight random server id, add business using a specified prefix
Device id states a queue on message queue, wherein specified prefix is preferably websocket.msg., by the queue and in advance
The publish-subscribe model interchanger stated is bound, and binding the routing key used is that specified prefix adds server id,
The queue just stated is monitored simultaneously;In addition, can state a broadcast type interchanger in advance, state what a mass-sending used
Queue, queue name are also the mode for adding serverId using specified prefix, use a general routing key and above-mentioned broadcast type
Interchanger binding, can be while listening for the queue that the mass-sending uses when starting websocket server.
B. client passes through application backstage progress user login operation, and after logging in, background service returns to a carrying and uses
Family id, i.e. uid's and validity period token;
C. client carries token by making long attended operation with websocket server after load balancing;
D.websocket server parses validity period and uid by token, carries out secondary place to the uid in validity period
Reason, the random uuid of position is added by uid, wherein the digit of the random uuid of multidigit be eight, then plus server id, formed
The wsuid is connected id by one new wsuid, establishes caching, meanwhile, it is done in cache server by uid
Key, wsuid add serverid to do value to be cached;
E. when application backstage carries out message push, if it is pocket transmission news, the broadcast type stated in step A is used
Message is pushed in the queue of all mass-sendings by interchanger and general mass-sending routing key;
F. all websocket servers all listen to the pocket transmission news, send a message to be connected to itself at this time
The all clients of websocket server, the message or a user can be received in different clients by completing all users
In the case of login, message can be received.
Embodiment two
It may be to be pushed for a certain designated user on backstage when PUSH message in the step E of above-described embodiment one,
If the message of push is the push of designated user, wsuid and the service of all correspondence uid are inquired in redis by uid
Message carrying wsuid is pushed in corresponding queue using publish-subscribe model interchanger according to server id by device id.
Websocket server receives only the wsuid institute of corresponding local server id for by monitoring different queues
Message is specified wsuid to be pushed to client by the message that need to be pushed, and is completed same user when different places log in, is guaranteed institute
There is the user client to receive corresponding message.
Claims (5)
1. logging in the method for distributed push the single user based on websocket more, which comprises the steps of:
A. start websocket server, generate a multidigit random server id, add server id using a specified prefix
A queue is stated on message queue, which is tied up with the publish-subscribe model interchanger stated in advance
Fixed, binding the routing key used is that specified prefix adds server id, while monitoring the queue just stated, in addition, in advance
It states a broadcast type interchanger, states that is mass-sended the queue used, the queue name for mass-sending the queue used is also to make
It with specified prefix plus the mode of server id, is bound using a general routing key and above-mentioned broadcast type interchanger, starting
It can be while listening for the queue that the mass-sending uses when websocket server;
B. client passes through application backstage progress user login operation, and after logging in, background service returns to a carrying user id,
That is uid's and validity period token;
C. client carries token by making long attended operation with websocket server after load balancing;
D.websocket server parses validity period and uid by token, carries out secondary treatment to the uid in validity period, leads to
Cross the random uuid that uid adds position, then plus server id, a new wsuid is formed, using the wsuid as client connection
Id establishes caching, meanwhile, key is done by uid in cache server, wsuid adds serverid to do value to be cached;
E. it when application backstage carries out message push, if it is pocket transmission news, is exchanged using the broadcast type stated in step A
Message is pushed in the queue of all mass-sendings by machine and general mass-sending routing key;
F. all websocket servers all listen to the pocket transmission news, send a message to be connected to itself at this time
The all clients of websocket server, the message or a user can be received in different clients by completing all users
In the case of login, message can be received.
2. the method for logging in distributed push the single user according to claim 1 based on websocket, feature more
It is, in step A, the digit of the random server id is eight.
3. the method for logging in distributed push the single user according to claim 1 based on websocket, feature more
It is, in step A, the specified prefix is websocket.msg..
4. the method for logging in distributed push the single user according to claim 1 based on websocket, feature more
It is, in step D, the digit of the random uuid of the multidigit is eight.
5. the method for logging in distributed push the single user according to claim 1 based on websocket, feature more
It is, in step E, if the message of push is the push of designated user, all correspondences uid is inquired in redis by uid
Wsuid and server id, using the publish-subscribe model interchanger stated in step A, according to server id, by message
It carries wsuid and is pushed to corresponding in column, websocket server will receive only correspondence by monitoring different queues
The message pushed needed for the wsuid of local server id, specifies wsuid to be pushed to client message, completes same user and exist
When different places log in, guarantee that all user clients receive corresponding message.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910467772.9A CN110062055B (en) | 2019-05-31 | 2019-05-31 | Websocket-based single-user multi-place login distributed push method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910467772.9A CN110062055B (en) | 2019-05-31 | 2019-05-31 | Websocket-based single-user multi-place login distributed push method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110062055A true CN110062055A (en) | 2019-07-26 |
CN110062055B CN110062055B (en) | 2021-07-20 |
Family
ID=67325241
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910467772.9A Active CN110062055B (en) | 2019-05-31 | 2019-05-31 | Websocket-based single-user multi-place login distributed push method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110062055B (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110708391A (en) * | 2019-10-17 | 2020-01-17 | 山东健康医疗大数据有限公司 | WebSocket-based internet inquiry realization method and system |
CN110971686A (en) * | 2019-11-29 | 2020-04-07 | 湖南御家科技有限公司 | Electronic mall customer service system supporting high concurrency and high availability |
CN111147746A (en) * | 2019-12-30 | 2020-05-12 | 深圳市金龙锋科技有限公司 | Intelligent early education equipment terminal management method |
CN111211934A (en) * | 2019-12-25 | 2020-05-29 | 曙光信息产业(北京)有限公司 | Cluster remote communication test method and system |
CN111222074A (en) * | 2020-01-09 | 2020-06-02 | 山东汇贸电子口岸有限公司 | Message pushing method and system based on Websocket protocol |
CN114124867A (en) * | 2021-11-18 | 2022-03-01 | 大连九锁网络有限公司 | Group-sending instant message transmission method under two-layer and three-layer hybrid network structure |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090063418A1 (en) * | 2007-08-31 | 2009-03-05 | Jonathan Robie | Method and an apparatus to deliver messages between applications |
CN103780681A (en) * | 2014-01-06 | 2014-05-07 | 南京莱斯信息技术股份有限公司 | High real-time Web application system and data real-time pushing method thereof |
CN104753817A (en) * | 2013-12-25 | 2015-07-01 | 中国移动通信集团公司 | Local analogy method and local analogy system for cloud computing message queue service |
US9137189B2 (en) * | 2011-03-24 | 2015-09-15 | Red Hat, Inc. | Providing distributed dynamic routing using a logical broker |
CN106936698A (en) * | 2017-04-13 | 2017-07-07 | 合肥市群智科技有限公司 | A kind of pc ends instant messaging application process based on websocket |
CN108683653A (en) * | 2018-05-07 | 2018-10-19 | 常熟市第人民医院 | A kind of active message push system based on WebSocket |
CN109040300A (en) * | 2018-09-04 | 2018-12-18 | 航天信息股份有限公司 | The method, apparatus and storage medium of PUSH message |
CN109660617A (en) * | 2018-12-18 | 2019-04-19 | 中电科华云信息技术有限公司 | A kind of information push method based on server cluster |
CN109802995A (en) * | 2018-12-13 | 2019-05-24 | 深圳壹账通智能科技有限公司 | Information push method, device, equipment and storage medium |
-
2019
- 2019-05-31 CN CN201910467772.9A patent/CN110062055B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090063418A1 (en) * | 2007-08-31 | 2009-03-05 | Jonathan Robie | Method and an apparatus to deliver messages between applications |
US9137189B2 (en) * | 2011-03-24 | 2015-09-15 | Red Hat, Inc. | Providing distributed dynamic routing using a logical broker |
CN104753817A (en) * | 2013-12-25 | 2015-07-01 | 中国移动通信集团公司 | Local analogy method and local analogy system for cloud computing message queue service |
CN103780681A (en) * | 2014-01-06 | 2014-05-07 | 南京莱斯信息技术股份有限公司 | High real-time Web application system and data real-time pushing method thereof |
CN106936698A (en) * | 2017-04-13 | 2017-07-07 | 合肥市群智科技有限公司 | A kind of pc ends instant messaging application process based on websocket |
CN108683653A (en) * | 2018-05-07 | 2018-10-19 | 常熟市第人民医院 | A kind of active message push system based on WebSocket |
CN109040300A (en) * | 2018-09-04 | 2018-12-18 | 航天信息股份有限公司 | The method, apparatus and storage medium of PUSH message |
CN109802995A (en) * | 2018-12-13 | 2019-05-24 | 深圳壹账通智能科技有限公司 | Information push method, device, equipment and storage medium |
CN109660617A (en) * | 2018-12-18 | 2019-04-19 | 中电科华云信息技术有限公司 | A kind of information push method based on server cluster |
Non-Patent Citations (3)
Title |
---|
ELTON F.DE SOUZE SOARES: "Evaluation of Server Push Technologies for Scalable Client-Server Communication", 《2018 IEEE SYMPISIUM ON SERVICE SYSTEM ENGINEERING》 * |
胡洋洋: "基于websocket的服务器推送技术的研究", 《中国优秀硕士学位论文全文数据库信息科技辑》 * |
陈涛: "基于MQTT协议的推送技术研究", 《软件导刊》 * |
Cited By (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110708391A (en) * | 2019-10-17 | 2020-01-17 | 山东健康医疗大数据有限公司 | WebSocket-based internet inquiry realization method and system |
CN110708391B (en) * | 2019-10-17 | 2022-07-12 | 山东浪潮智慧医疗科技有限公司 | WebSocket-based internet inquiry realization method and system |
CN110971686A (en) * | 2019-11-29 | 2020-04-07 | 湖南御家科技有限公司 | Electronic mall customer service system supporting high concurrency and high availability |
CN110971686B (en) * | 2019-11-29 | 2022-03-08 | 湖南御家科技有限公司 | Electronic mall customer service system supporting high concurrency and high availability |
CN111211934A (en) * | 2019-12-25 | 2020-05-29 | 曙光信息产业(北京)有限公司 | Cluster remote communication test method and system |
CN111211934B (en) * | 2019-12-25 | 2022-04-12 | 曙光信息产业(北京)有限公司 | Cluster remote communication test method and system |
CN111147746A (en) * | 2019-12-30 | 2020-05-12 | 深圳市金龙锋科技有限公司 | Intelligent early education equipment terminal management method |
CN111222074A (en) * | 2020-01-09 | 2020-06-02 | 山东汇贸电子口岸有限公司 | Message pushing method and system based on Websocket protocol |
CN114124867A (en) * | 2021-11-18 | 2022-03-01 | 大连九锁网络有限公司 | Group-sending instant message transmission method under two-layer and three-layer hybrid network structure |
CN114124867B (en) * | 2021-11-18 | 2023-07-04 | 大连九锁网络有限公司 | Group-sending instant message transmission method under two-layer and three-layer mixed network structure |
Also Published As
Publication number | Publication date |
---|---|
CN110062055B (en) | 2021-07-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110062055A (en) | The method of distributed push is logged in single user based on websocket more | |
EP3595268B1 (en) | Streaming media resource distribution method, system, edge node and central dispatching system | |
US9325786B2 (en) | Peer-to-peer interactive media-on-demand | |
CN103621151B (en) | For managing the technology that stream broadcasts media business in network entity | |
US9282448B2 (en) | Method, system and apparatus for providing streaming media service | |
CN102238226B (en) | Conversation shift on the network centered by content | |
EP3595325B1 (en) | Method for realizing multicast and relevant network device | |
CN106131138B (en) | A kind of real-time supplying system of display data and method based on non-obstruction queue | |
EP3598716A1 (en) | Methods for uploading and downloading streaming media resource, distribution system, and streaming media server | |
TW200913548A (en) | Performing paging in a wireless peer-to-peer network | |
US20190200282A1 (en) | Procedures for dynamically configured network coding based multi-source packet transmission utilizing icn | |
US11251981B2 (en) | Communication method and apparatus | |
CN101895576A (en) | P2P distributed streaming media live broadcast method with small-startup time delay | |
EP3576371B1 (en) | Method and system for transmitting streaming media resource | |
WO2012000227A1 (en) | Method of p2p video communication implemented on web page | |
EP2569899B1 (en) | Content distribution in a P2P infrastructure by means of multicast connections | |
CA2453583A1 (en) | Multimodal session support on distinct multi channel protocol | |
WO2016180284A1 (en) | Service node allocation method, device, cdn management server and system | |
US20140161125A1 (en) | Method, duplication point device, and system for data flow reuse transmission | |
WO2021238937A1 (en) | Communication method, device and system | |
WO2010022619A1 (en) | A method and system for user selection | |
WO2014194526A1 (en) | Method, device and system for obtaining mobile network data resources | |
CN101771550A (en) | Method, device and system for acquiring media content in P2P network | |
CN100373894C (en) | Instant communication roating method for mobile network | |
CN106658084A (en) | Video stream providing method and apparatus |
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 |