A kind of white list based on player heart beating generates system and method
Technical field
The present invention relates to white list and generate field, a kind of white list based on player heart beating generates system
System and method.
Background technology
At present, net cast website generate white list method be based primarily upon before user data, the temporally cycle
(my god, week, the moon) periodically calculates, and calculates and needs to realize code logic according to specified rule, so can not ensure white list and
Shi Xing.And in the business scenario of net cast website, a lot of direct broadcasting room main broadcasters are sending out at initiation interactive event or website
When playing special activities, any active ues between needing just for viewing current live or user active on website, at this moment, from
The white list of line computation can seem not enough on precision, easily allows the white list condition that meets, the but user outside white list
It is restricted.
Summary of the invention
For defect present in prior art, it is an object of the invention to provide a kind of white name based on player heart beating
Single generation system and method, generates white list according to player heart beating, it is ensured that the promptness of white list, improves the accurate of white list
Degree.
For reaching object above, the present invention takes a kind of white list based on player heart beating to generate system, including: client
End player, for the real-time heartbeat message reporting live video to message processing module;Message processing module, is used for caching symbol
Close the heartbeat message of call format, and the data of caching are carried out data slice division;Computing module, including multiple computing units,
Each computing unit stores multiple data slice, and verifies the heartbeat message of data slice;White list module, tests for reception
Demonstrate,prove successful heartbeat message, and the user profile of its correspondence is stored with the form of white list burst.
On the basis of technique scheme, described message processing module abandons the heartbeat message not meeting call format,
It is set form by heartbeat message pretreatment.
On the basis of technique scheme, the data slice divided in described message processing module, its time grain divided
Degree is 1 second, and each data slice both less than or is equal to 1MB.
On the basis of technique scheme, described computing module is that each data slice distributes data slice ID, by number
According to sheet ID according to Hash hash algorithm remainder, and data slice identical for remainder is left in same computing unit.
On the basis of technique scheme, the heartbeat message of described live video includes ID and identification code, identifies
Code includes that timestamp, client player ID and random number, described identification code are regular lengths, and encrypt.
On the basis of technique scheme, identification code is deciphered by described computing unit, believes according to identification code verification heart beating
The effectiveness of breath, is submitted to white list module by effective heartbeat message and is used for updating.
The present invention also provides for a kind of white list based on player heart beating and generates method, including step:
S1. client player reports the heartbeat message of live video in real time to message processing module, and heartbeat message includes
ID and identification code;
S2. message processing module caching meets the heartbeat message of call format;
S3. message processing module is according to 1 second data fragmentation by caching of time granularity, and after burst, the data more than 1MB are pressed
According to every 1MB burst again, the residue data less than 1MB are divided into a data slice, and the data slice divided are passed to calculating mould
Block;
S4. computing module is that each data slice distributes data slice ID, by data slice ID according to hash algorithm remainder, and
Data slice identical for remainder is assigned in a computing unit;
The most each computing unit, according to identification code in data slice, verifies the effectiveness of heartbeat message, and by effective heart beating
Information is sent to white list module;
S6. white list module is by user corresponding for heartbeat message, updates to white list burst.
On the basis of technique scheme, described identification code includes timestamp, client player ID and random number, institute
Stating identification code is regular length, and encrypts.
On the basis of technique scheme, in described S5, identification code is decrypted by computing unit, if timestamp with work as
Whether the time deviation of front server is within 1 minute, and client player ID compliant, then heartbeat message is effective.
On the basis of technique scheme, in described white list module, store heartbeat message by ID burst, and lead to
Cross Restful interface or RPC interface shape, apply for other.
The beneficial effects of the present invention is: generate white list, Ke Yi in real time by the heartbeat message of client player
User watch live during, get the viewed status of user in real time, it is ensured that the promptness of white list;So generate is white
Name monoenergetic precisely determines the active state of active user, and then can guarantee that participating in interactive user is effective any active ues,
Also improve the experience of user simultaneously.
Accompanying drawing explanation
Fig. 1 is that embodiment of the present invention white list based on player heart beating generates system schematic;
Fig. 2 is that embodiment of the present invention white list based on player heart beating generates method flow diagram.
Detailed description of the invention
Below in conjunction with drawings and Examples, the present invention is described in further detail.
As it is shown in figure 1, present invention white list based on player heart beating generates system, including client player, information
Processing module, computing module and white list module.
Client player, for playing video to user, is additionally operable to report live video to message processing module in real time
Heartbeat message.Heartbeat message includes ID and identification code, and ID is the ID mark of each user's uniqueness.Identification code includes
Timestamp, client player ID and random number, the create-rule of identification code is: timestamp+client player ID+ is random
Number, wherein client terminal playing ID is the Unique ID of client player, and identification code is regular length, and when using
Need encryption.
Message processing module, meets the heartbeat message of call format, and the data of caching is carried out data slice for caching
Divide.Concrete, that message processing module cache client player reports heartbeat message, and abandon and do not meet call format
Heartbeat message, the situation not meeting call format includes: ID is for sky or does not meets data field type, timestamp form
Not illegal etc. to, client type mark.Heartbeat message pretreatment is following set form by message processing module:
Message processing module, is additionally operable to the data of caching are carried out data slice division.Wherein, according to time granularity 1 second point
Sheet, if there being the data more than 1MB after burst, according to every 1MB burst again, residue is divided into a data slice less than 1MB,
And the data slice divided is passed to computing module.
Computing module, including multiple computing units, after each computing unit receives and store message processing module division
Data slice.Concrete, each data slice stores the computing unit specified, and computing module is that each data slice distributes data
Sheet ID, by data slice ID according to Hash hash algorithm remainder, and leaves data slice identical for remainder in same computing unit
In.It addition, computing unit is additionally operable to verify the heartbeat message of data slice, identification code is deciphered, according to identification code verification
The effectiveness of heartbeat message, is submitted to white list module by effective heartbeat message and is used for updating.
White list module, for receiving the heartbeat message being proved to be successful, and divides the user profile of its correspondence with white list
The form storage of sheet.
Present invention white list based on player heart beating generates method, specifically includes following steps:
S1. client player reports the heartbeat message of live video in real time to message processing module, and heartbeat message includes
ID and identification code, identification code includes that timestamp, client player ID and random number, described identification code are regular lengths,
And identification code is encrypted.
S2. message processing module caching meets the heartbeat message of call format.Concrete, message processing module caching from
The creed information of client player, abandons the heartbeat message not meeting call format, and by heartbeat message pretreatment for unified
Form.
S3. message processing module is according to 1 second data fragmentation by caching of time granularity, after burst, for the number more than 1MB
According to, according to every 1MB burst again, the residue data less than 1MB are individually divided into a data slice, it is ensured that each data slice is little
In or equal to 1MB, wherein comprise at least one heartbeat message, and the data slice divided passed to computing module.
S4. computing module is that each data slice distributes data slice ID, by data slice ID according to hash algorithm remainder, and
Data slice identical for remainder is assigned in a computing unit.Further, the number N delivery to computing unit, it is thus achieved that computing unit
ID, so can learn which computing unit is which data slice assign in, improves the horizontal extension ability of computing unit, according to number
Computing unit is increased and decreased accordingly according to the scale of amount.
The identification code comprised in data slice is decrypted by the most each computing unit, then resolves identification code, it is judged that the time
Whether the time deviation of stamp and current server is within 1 minute, and checking client player ID meets rule the most further
Model;If it is not, abandon the heartbeat message that this identification code is corresponding.If client players ID compliant, then this identification code verification is described
Success, the heartbeat message that i.e. this identification code is corresponding is effective, and effective heartbeat message is sent to white list module.If client playing
Device ID does not meets specification, then abandon the heartbeat message that this identification code is corresponding.
S6. white list module is by user corresponding for heartbeat message, and (white list presses ID burst in renewal to white list burst
Storage).It addition, white list can by Restful interface or RPC (Remote Procedure Call Protocol, remotely
Invocation of procedure agreement) interface shape, it is exposed to other application and uses.Based on this white list, can in multiple important scenes mistake
Filter inactive users account (i.e. account outside white list).
The present invention is not limited to above-mentioned embodiment, for those skilled in the art, without departing from
On the premise of the principle of the invention, it is also possible to make some improvements and modifications, these improvements and modifications are also considered as the protection of the present invention
Within the scope of.The content not being described in detail in this specification belongs to prior art known to professional and technical personnel in the field.