Summary of the invention
The purpose of the present invention is to provide a kind of information push method and system based on internet television, it is existing for solvingThere is the problem of television terminal and the long connection of server end cause operation cost to increase in technology.
The present invention is solved the above problems by following technical proposals:
A kind of information push method based on internet television, includes the following steps:
Step S100: client is online, sends and requests to server end, and server end returns to client regionThe information of Master client;
Step S200: long connection is established in client and the networking of Mater client;
Step S300: for server end by Mater client to client push message, client passes through Master clientHold the message at response server end.
Optionally, the step S100 is specifically included:
Step S110: it is logged in after client booting according to configuration information to given server end;
Step S120: the logging request of received server-side to client searches client packets according to client-side informationInformation, if finding grouping information, into next step;Otherwise, newly-built client packets process is triggered;
Step S130: if client is not registered in server end, client registers are carried out, while it is competing to trigger MasterSelect process;If client is registered, client-side information more new technological process is triggered;
Step S140: server end will log in the information of the Master client of successful information and client regionReturn to client.
Optionally, the newly-built client packets process specifically:
Grouping information is established according to the client packets rule of system configuration, and is returned.
Optionally, the Master campaigns for process specifically:
Judge whether current group is sky, if it is, the client being newly added is promoted as Master client;It is noThen, according to the Master client election strategy of system configuration, new Master client is elected, into next step.
Optionally, the client-side information more new technological process specifically:
Rule is updated according to the client-side information of system configuration, information update is judged whether to, if it is, information is moreEnter after new in next step, otherwise, is directly entered in next step.
Optionally, the step S200 is specifically included:
Step S210: the Master client-side information for the client region that client is returned according to server end, withMaster client establishes long connection;
Step S220:Master client obtains message push server client information, and establishes long connection;
Step S230:Master client reports the client-side information currently connected.
A kind of message push system based on internet television, including client and server end, the client kimonosBusiness device end is for executing the described in any item methods in front.
Compared with prior art, the present invention have the following advantages that and the utility model has the advantages that
(1) present invention utilizes client resources elects the mode of Master node to solve number of terminals with region networkingAmount, which increases, causes number of servers to increase therewith, and operation cost increased contradiction therewith has saved server cost, improved and disappearCease pushing efficiency.
Embodiment 1:
In conjunction with shown in attached drawing 1 and Fig. 2, a kind of information push method based on internet television includes the following steps:
Step S100: client is online, sends and requests to server end, and server end returns to client regionThe information of Master client;
Step S110: it is logged in after client booting according to configuration information to given server end;
Step S120: the logging request of received server-side to client, by server end according to client-side information (clientClient information includes machine core, type, MAC, outer net IP, port;Intranet IP, port) client packets information is searched, if foundGrouping information, into next step;Otherwise, newly-built client packets process is triggered: according to the client packets of system configuration ruleGrouping information is established, and is returned;Following rule can be used in client packets rule:
It configures (standard of grouping):
1: region, such as: Sichuan, Chongqing etc.;
2: each grouping client terminal quantity, such as: 50,100;
Region and each grouping client list quantity configuration correspond.
Rule:
1: being segmented by region division IP address, such as: Sichuan -> 182.128.0.0 to 182.143.255.255;
2: limiting further according to client terminal quantity by the region division is multiple groupings, such as: group_sc_1
3: reaching quantity limitation, then automatic newly-built grouping, such as: group_sc_2, group_sc_3 ..., group_sc_n.
Step S130:
If client is not registered in server end, client registers are carried out, according to client ip, client is pressed into areaDomain grouping saves, and completes the registration of client, and by the region KEY where client, outer net IP, port and Intranet IP, holdsMouth is saved, while triggering Master election contest process: judging whether current group is sky, if it is, the visitor that will be newly addedIt is promoted as Master client in family end;Otherwise, it according to the Master client election strategy of system configuration, elects newMaster client, into next step;
Master client election strategy can be used as follows:
It configures (standard of election):
1: machine core, type
Rule:
1: different machine cores, type represent the different configurations of TV, according to existing TV set core, machine when system initializationType establishes a set of machine core _ type -> weight mapping relations according to configuration height, see the table below 1, and weight is bigger, and configuration is higher, thenThe performance for representing TV is better, such as:
| Machine core _ type | Weight |
| ZOH92Gi_55Q6A | 1 |
| ZOH92Gi_55Q6B | 2 |
| ZOH92Gi_55Q6C | 3 |
1 machine core of table _ type weight information table
2: the client being newly added inquires corresponding power in type to system machine core _ type weight information table according to machine coreWeight information, then be compared with the Master client in current group, if it is greater than the weight of current Master client, thenMaster is set by the client being newly added, while triggering Master changing process, is otherwise not processed.
Master changing process:
It successively notifies all clients in current group, issues newest Master client node information, client is receivedIt is triggered after to information: step S210.
If client is registered, client-side information more new technological process is triggered: more according to the client-side information of system configurationNew rule, judges whether to information update, if it is, entering in next step after information update, otherwise, is directly entered nextStep;
Client, which updates rule, can be used such as under type:
It configures (field for needing to update):
1: machine core, type, outer net IP, port;Intranet IP, port
Rule:
1: registration information being found according to MAC, successively the field in comparative arrangement, changes, and updates, and is otherwise not processed.
Step S140: server end will log in the information of the Master client of successful information and client regionReturn to client;
Step S200: long connection is established in client and the networking of Mater client;
Step S210: the Master client-side information for the client region that client is returned according to server end, withMaster client establishes long connection;
Step S220:Master client and message push service cluster establish long connection;
Master client obtains available message push server information to load-balanced server, and establishes long companyIt connects;
Step S230:Master client reports the client-side information currently connected.
Step S300: for server end by Mater client to client push message, client passes through Master clientHold the message at response server end.
Although reference be made herein to invention has been described for explanatory embodiment of the invention, and above-described embodiment is only this hairBright preferable embodiment, embodiment of the present invention are not limited by the above embodiments, it should be appreciated that those skilled in the artMember can be designed that a lot of other modification and implementations, these modifications and implementations will fall in principle disclosed in the present applicationWithin scope and spirit.