CN103297455B - Connection sharing method between browser and device - Google Patents

Connection sharing method between browser and device Download PDF

Info

Publication number
CN103297455B
CN103297455B CN201210046581.3A CN201210046581A CN103297455B CN 103297455 B CN103297455 B CN 103297455B CN 201210046581 A CN201210046581 A CN 201210046581A CN 103297455 B CN103297455 B CN 103297455B
Authority
CN
China
Prior art keywords
entity
multicast group
principal
message
multicast
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.)
Active
Application number
CN201210046581.3A
Other languages
Chinese (zh)
Other versions
CN103297455A (en
Inventor
禹扬帆
王鹏程
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201210046581.3A priority Critical patent/CN103297455B/en
Publication of CN103297455A publication Critical patent/CN103297455A/en
Application granted granted Critical
Publication of CN103297455B publication Critical patent/CN103297455B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

This application discloses the connection sharing method between a kind of browser and device, wherein, the method includes:The entity being used for perform script program in each browser opened is seized to same resource identifier, and wherein, robbing and accounting for the entity of resource identifier is principal, and other is not robbed and accounted for the entity of resource identifier is from entity;Principal is attached with server;Share, from entity, the connection set up between principal and server to carry out message transmission with server.Present application addresses the problem that the server leading to due to buffer size restriction in prior art connects the negligible amounts of browser, the efficiency of service of server declines, reach the shared effect of the long connection connecting between multiple browsers.

Description

Connection sharing method between browser and device
Technical field
The application is related to field of Internet communication, in particular to a kind of browser between connection sharing method and dress Put.
Background technology
Web push technology has begun to popular, and some large-scale Internet firms have begun to apply on a large scale now This technology, the technology that represents therein has WebSocket, the technology such as Flash Socket, can be broken through using Web push technology The long connection of TCP (Transmission Control Protocol, transmission control protocol) that traditional HTTP can not accomplish, but Have also been introduced a new problem, this problem exactly, when a user opens multiple browser, can produce many simultaneously A long phenomenon being connected to service end each initiated by individual browser, and under many circumstances it is more likely that being multiple What browser was seen is the different web pages of same website, thus service end needs to maintain the Socket number times over client terminal quantity Amount.Therefore, create the problem of the connection number of long connection:When connection number is too big, the order caching of service end TCP can become Geometric trend increases, and when internal memory exhausts, server receives new connection again by having no idea, then server can occur The phenomenon of refusal service, the client terminal quantity of server providing services also can only be limited in a less scope.
However, connect the problem of number for the connection of above-mentioned length, the long connection that prior art can pass through Socket is shared To solve, its ultimate principle is to find one for the data buffer area that can share between multiple browsers, then, by number Connect the purpose that number is shared according to transferring in buffer area to reach, above-mentioned shared buffer area has HTML5 Web Storage, The forms such as Cookie, Flash Share Object, but, because above-mentioned shared buffer area is essentially all based on file system System is formed, and great majority can not be identified by different browsers, for example, if relief area uses Cookie or Web Storage technology, then these storages have the constraint of very strong browser origin policy, and implementation is all clear at each Look at the inside of device, therefore cannot realize the shared of browser data between multiple different brands;Simultaneously as relief area is base In the data buffering of file, lead to access speed very slow;Additionally, the size of relief area is also restricted, browser manufacturer is The locally stored safety of protection client, for locally stored capacity all restricted, typically all without exceeding several million.
Therefore, from above-mentioned scene, realize in the shared scheme of long connection between multiple browsers existing, due to Data buffer area is the form based on file system, and there is the server that can not identify different brands, can only identify Part server, it is impossible to the connection realized between multiple browsers truly is shared, concurrently there are buffer area and accesses speed Degree is slow, the conditional problem of buffer size, leads to affect the quantity that server connects browser, reduces the service effect of server Rate.
Content of the invention
This application provides the connection sharing method between a kind of browser and device, to solve above-mentioned in correlation technique asking Topic.
A kind of one side according to the application, there is provided the connection sharing method between browser, the method includes:Beat The entity being used for perform script program in each browser opened is seized to same resource identifier, wherein, robs and accounts for The entity of resource identifier is principal, and other is not robbed and accounted for the entity of resource identifier is from entity;Principal and server It is attached;Share, from entity, the connection set up between principal and server to carry out message transmission with server.
Preferably, share, from entity, the connection set up between principal and server to carry out message transmission with server Step includes:The message that principal the reception server sends;The message receiving multicast is given principal positioned at same by principal In one multicast group from entity.
Preferably, principal by the message receiving multicast give that principal is located in same multicast group from entity Step includes:From entity obtain principal multicast message mark, wherein, identify for unique mark from entity one Individual;From entity judge itself identify whether consistent with the mark the message of principal multicast;If consistent, execution judges step Rapid entity judges that the message of principal multicast is belonging to itself, and stores message.
Preferably, after principal is attached with server, also include:From entity every predetermined period preempting resources Identifier;If when the success of preempting resources identifier and principal appearance exception, robbing and account for being changed into from entity of resource identifier , abnormal principal and is changed into from entity in new principal.
Preferably, principal is added in multicast group by following steps:Principal judges whether to add multicast group;If It is not added in multicast group, then principal judges to whether there is the multicast group name of multicast group in shared file;If there is multicast The multicast group name of group, then principal multicast group name according to present in shared file addition multicast group;If there is not multicast Group multicast group name, then principal create the multicast group name for unique mark multicast group, will create multicast group name Write shared file, and multicast group is added according to the multicast group name creating.
Preferably, it is added to multicast group by following steps from entity:Judge whether to add multicast group from entity;If It is not added in multicast group, then judge shared file, to whether there is the multicast group name of multicast group from entity;If there is multicast The multicast group name of group, then add multicast group from entity multicast group name according to present in shared file;If there is not multicast The multicast group name of group, then the method for the multicast group name of the acquisition multicast group being provided according to principal from entity obtains multicast group Multicast group name, by obtain multicast group name write shared file in, and according to obtain multicast group name add multicast Group.
Preferably, share, from entity, the connection set up between principal and server to carry out message transmission with server Step includes:Principal receives each from entity according to sending the message that message approach sends, and wherein, sends message approach by leading Entity provides;The message of reception is sent to server according to sending message approach by principal.
A kind of another aspect according to the application, there is provided the connection sharing means between browser, this device includes:First Judging unit, for judging in the current browser opened, whether the entity for perform script program is principal, wherein, The entity being used for perform script program in the current browser opened is seized to same resource identifier, robs and accounts for providing The entity of source identifier is principal, and other is not robbed and accounted for the entity of resource identifier is from entity;Connection unit, for When entity in the current browser opened is principal, principal is attached with server;Shared cell, for leading The connection set up between entity and server shares to from entity so that carrying out message transmission by connecting with server from entity.
Preferably, shared cell includes:First receiver module, based on the entity in the current browser opened During entity, the message that the reception server sends;Group broadcasting module, for giving principal positioned at same by the message receiving multicast In individual multicast group from entity.
Preferably, group broadcasting module includes:Acquisition submodule, is from reality for the entity in the current browser opened During body, obtain the mark in the message of principal multicast, wherein, identify for unique mark from one of entity;Judge son Module, for judging to identify whether consistent with the mark the message of principal multicast from entity itself, if unanimously, judges The message going out principal multicast is belonging to itself, and stores message.
Preferably, this device also includes:Preemption unit, is from entity for the entity in the current browser opened When, after principal is attached with server, every predetermined period preempting resources identifier;Converting unit, for robbing Account for resource identifier success and when principal abnormal, by rob account for resource identifier be changed into new principal from entity, Abnormal principal occurs be changed into from entity.
Preferably, this device also includes:Second judging unit, based on the entity in the current browser opened During entity, judge whether principal has added multicast group;3rd judging unit, for when principal is not added to multicast group, Judge in shared file, to whether there is the multicast group name of multicast group;First addition unit, for judging in the 3rd judging unit Exist in shared file multicast group multicast group name when, principal is added by multicast group name according to present in shared file Multicast group;First creating unit, for judging the multicast group name that there is not multicast group in shared file in the 3rd judging unit When, create the multicast group name for unique mark multicast group, by the multicast group name creating write shared file, and according to wound Principal is added multicast group by the multicast group name built.
Preferably, this device also includes:4th judging unit, for the entity in the current browser opened be from During entity, judge whether added multicast group from entity;5th judging unit, for, when entity is not added to multicast group, sentencing Whether there is the multicast group name of multicast group in disconnected shared file;Second addition unit, for judging altogether in the 5th judging unit When enjoying the multicast group name that there is multicast group in file, multicast group name according to present in shared file will be from entity addition group Broadcast group;Acquiring unit, for when the 5th judging unit judges the multicast group name that there is not multicast group in shared file, according to The method of the multicast group name of acquisition multicast group that principal provides obtains the multicast group name of multicast group, the multicast group that will obtain In title write shared file, and multicast group will be added from entity according to the multicast group name obtaining.
Preferably, shared cell includes:Second receiver module, based on the entity in the current browser opened During entity, receive each from entity according to sending the message that message approach sends, wherein, send message approach and carried by principal For;Sending module, for being sent to server according to transmission message approach by the message of reception.
In this application, when user opens multiple browser, it is used for the entity of perform script program in each browser Can go to compete preempting resources identifier, wherein, rob the entity accounting for resource identifier as principal, this principal just becomes to be sent out Send and receive the main body of message, other is not robbed the entity accounting for resource identifier as from entity, entered with principal from entity Row message transmission.So all of entity all can share this linkup transmit and receive message, solve in prior art due to The problem that the server that buffer size limits and leads to connects the negligible amounts of browser, the efficiency of service of server declines, Reach the shared effect of the long connection connecting between multiple browsers.
Brief description
Accompanying drawing described herein is used for providing further understanding of the present application, constitutes the part of the application, this Shen Schematic description and description please is used for explaining the application, does not constitute the improper restriction to the application.In the accompanying drawings:
Fig. 1 be according to the browser of the embodiment of the present application between connection shared system a kind of preferred structural representation;
Fig. 2 be according to the browser of the embodiment of the present application between connection sharing method a kind of preferred flow chart;
Fig. 3 be according to the browser of the embodiment of the present application between connection sharing means a kind of preferred structural representation;
Fig. 4 be according to the browser of the embodiment of the present application between connection sharing means another kind of preferably structural representation Figure;
Fig. 5 be according to the browser of the embodiment of the present application between connection sharing means another kind of preferably structural representation Figure;
Fig. 6 be according to the browser of the embodiment of the present application between connection sharing means another kind of preferably structural representation Figure;
Fig. 7 be according to the browser of the embodiment of the present application between connection sharing means another kind of preferably structural representation Figure;
Fig. 8 be according to the browser of the embodiment of the present application between connection sharing means another kind of preferably structural representation Figure;
Fig. 9 be according to the browser of the embodiment of the present application between connection sharing means another preferred structural representation Figure;
Figure 10 be according to the browser of the embodiment of the present application between the working method of connection sharing means a kind of preferably Schematic diagram;
Figure 11 be according to the browser of the embodiment of the present application between connection sharing means in preempting resources identifier one kind Preferably schematic diagram;
Figure 12 be according to the browser of the embodiment of the present application between connection sharing means in entity add multicast group one kind Preferably schematic diagram;
Figure 13 be according to the browser of the embodiment of the present application between connection sharing means in message transmission a kind of preferably Schematic diagram.
Specific embodiment
To describe the application in detail below with reference to accompanying drawing and in conjunction with the embodiments.It should be noted that not conflicting In the case of, the embodiment in the application and the feature in embodiment can be mutually combined.
Before the further detail below of description present embodiments, will be described with reference to Figure 1 and can be used for realizing this Shen The suitable counting system structure of of principle please.In the following description, except as otherwise noted, otherwise will with reference to by one or Multiple actions of computer execution and the symbol of operation represent to describe present embodiments.As such, it will be understood that sometimes It is referred to as this kind of action of computer execution and operate the processing unit including computer to represent data to structured form The manipulation of the signal of telecommunication.This manipulation transforms data or safeguard it on the position in the accumulator system of computer, this is with this The mode of the technical staff in field all understanding reconfigures or changes the operation of computer.The data structure safeguarding data is that have The physical location of the memorizer of particular community defined in the form of data.Although however, this Shen described in above-mentioned context Please, but its being not intended to limit property, as understood by those skilled in the art, action described below and operation Each side also can be realized with hardware.
Turn to accompanying drawing, wherein identical reference number refers to identical element, and the principle of the application is shown in a conjunction Realize in suitable computing environment.Hereinafter describe based on embodiments herein, and be not considered as with regard to not clear and definite herein Description alternative embodiment and limit the application.
Fig. 1 shows the schematic diagram of the example computer architecture that can be used for these equipment.Mesh for description , the architecture painted is only an example of proper environment, and not the range to the application or function proposition are any Limitation.Also this computing system should not be construed to there is any dependence or demand to any component shown in Fig. 1 or a combination thereof.
The principle of the application can be operated using the universal or special calculating of other or communication environment or configuration.It is applied to this The example of the well-known computing system, environment and configuration of application includes but is not limited to, personal computer, server, many places Reason device system, the system based on microprocessor, the distribution of minicomputer, mainframe computer and the arbitrary said system of inclusion or equipment Formula computing environment.
In its most basic configuration, the connection shared system 100 between the browser in Fig. 1 at least includes:One website Server 102 and one or more client 104.Server 102 can include but is not limited to Micro-processor MCV or can compile The processing meanss of journey logical device FPGA etc., be used for the storage device of data storage and the transmitting device with client communication; Client 104 can include:The transmitting device of Micro-processor MCV and server communication and the display device of user mutual.? In the specification and claims, " the connection shared system between browser " can also be defined as being able to carry out software, consolidate Part or microcode are realizing any nextport hardware component NextPort of function or the combination of nextport hardware component NextPort.Connection shared system 100 between browser is very To being distributed, to realize distributed function.
As used in this application, the connection that term " module ", " assembly " or " unit " can refer between browser is shared The software object of execution or routine in system 100.Difference assembly described herein, module, unit, engine and service can be by realities It is now object or the process that (for example, as single thread) is executed on the connection shared system 100 between browser.Although this The described system and method in place preferably to be realized with software, but the realization of the combination of hardware or software and hardware is also can Can and be contemplated.
Embodiment 1
This application provides the connection sharing method between a kind of browser, specifically, as shown in Fig. 2 the method includes:
S102, the entity being used for perform script program in the current browser opened is carried out to same resource identifier Seize, wherein, robbing and accounting for the entity of resource identifier is principal, and other is not robbed and accounted for the entity of resource identifier is from reality Body;Preferably, above-mentioned entity can be carried out Flash shell script plug-in unit, functional module or hardware device or Execution has the plug-in unit of other programs, functional module or the hardware device of identical function it is preferred that above-mentioned plug-in unit and function mould Block can be developed by third party, and hardware device can be to run one of the terminal unit of described browser part, or, several The combination of individual part.
S104, principal is attached with server;
S106, shares, from entity, the connection set up between principal and server and to carry out message transmission with server.Tool For body, first, the message that principal the reception server sends, and the message receiving multicast is given principal positioned at same In individual multicast group from entity;Then, principal receives each from entity according to sending the message that message approach sends, wherein, Sending message approach is provided by principal;Finally, the message of reception is sent to server according to sending message approach by principal.
In this preferred embodiment, when user opens multiple browser, in each browser, it is used for perform script journey The entity of sequence can go to compete preempting resources identifier, wherein, robs the entity accounting for resource identifier as principal, this principal Just become the main body sending and receiving message, other is not robbed and accounted for the entity of resource identifier as from entity, from entity with Principal carries out message transmission.So all of entity all can be shared this linkup transmit and receive message, solve existing skill The server leading to because buffer size limits in art connects the negligible amounts of browser, the efficiency of service of server declines Problem, reached between multiple browsers long connect connect shared effect.
Present invention also provides a kind of connection sharing foundation between principal and server from entity to enter with server The preferred method of row message transmission, specifically, the method comprises the steps:The message that principal the reception server sends; Principal by the message receiving multicast give principal be located at same multicast group in from entity.Preferably implement above-mentioned Example in, principal is connected with server, and the message of the server of reception is sent to from entity it is achieved that all of from entity The message that can be issued come the reception server by the connection between principal and server, and then reached multiple browsers Between long connect connect shared effect.
Present invention also provides the message receiving multicast is given principal by a kind of principal is located at same multicast group In the preferred method from entity, specifically, the method includes:Obtain the mark the message of principal multicast from entity, Wherein, identify for unique mark from one of entity;Judge identifying whether of itself and disappearing of principal multicast from entity Mark in breath is consistent;If consistent, execution judges that the entity of step judges that the message of principal multicast is belonging to itself, And store message.In technique scheme, from entity, group is judged by the mark the message of acquisition principal multicast That whether the disappearance broadcast belongs to itself it is ensured that the correct transmission of message.
Connection sharing method also between above-mentioned browser for the application is optimized, specifically, in principal and service After device is attached, the connection sharing method between above-mentioned browser also includes:From entity every predetermined period preempting resources mark Know symbol;If preempting resources identifier success and when principal abnormal, rob account for resource identifier be changed into new from entity Principal, abnormal principal occurs and is changed into from entity.In above-mentioned preferred technical scheme, rob every predetermined period from entity Account for resource identifier, when principal abnormal so that when exception occurring or is closed by the user in principal, perform script journey There is the new principal that can occupy resource identifier it is ensured that information normally interacts in sequence entity.
Present invention also provides a kind of principal is added to the preferred scheme of multicast group by following steps, specifically come Say, the program includes:Principal judges whether to add multicast group;If not being added in multicast group, principal judges shared Whether there is the multicast group name of multicast group in file;If there is the multicast group name of multicast group, principal is according to shared literary composition Multicast group name present in part adds multicast group;If there is not the multicast group name of multicast group, principal creates for only The multicast group name of one mark multicast group, by the multicast group name creating write shared file, and according to the multicast group name creating Claim to add multicast group.By above-mentioned preferred embodiment, there is provided a kind of method that specific principal is added to multicast group, And then ensure that principal can utilize multicast group that the message receiving is multicast in all of program entity for perform script.
Present invention also provides a kind of preferred scheme being added to multicast group from entity, specifically, the program includes: Judge whether to add multicast group from entity;If not being added in multicast group, judge to whether there is shared file from entity The multicast group name of multicast group;If there is the multicast group name of multicast group, from entity multicast according to present in shared file Group name adds multicast group;If there is not the multicast group name of multicast group, the acquisition multicast being provided according to principal from entity The method of the multicast group name of group obtains the multicast group name of multicast group, and the multicast group name obtaining is write in shared file, And multicast group is added according to the multicast group name obtaining.By above-mentioned preferred embodiment, there is provided one kind is specifically from reality Body is added to the method for multicast group it is ensured that can receive, from entity, the message that principal can utilize multicast group multicast.
Present invention also provides a kind of connection sharing foundation between principal and server from entity to enter with server The preferred method of row message transmission, specifically, the method comprises the steps:Principal receive each from entity according to send out Send the message that message approach sends, wherein, sending message approach is provided by principal;Principal will connect according to sending message approach The message received is sent to server.In above-mentioned preferred embodiment, built between principal and server by sharing from entity Vertical connection to carry out message transmission with server so that carrying out message transmission from entity and principal, and then realizes multiple clear The long connection connecting between device of looking at is shared.
Embodiment 2
On the basis of embodiment 1, present invention also provides the connection sharing means between a kind of browser, specifically, such as Fig. 3, this device includes:First judging unit 302, for judging in the current browser opened for perform script program Whether entity is principal, and wherein, the entity in the current browser opened is seized to same resource identifier, robs The entity accounting for resource identifier is principal, and other is not robbed and accounted for the entity of resource identifier is from entity;Preferably, above-mentioned Entity can be carried out plug-in unit, functional module or the hardware device of Flash shell script it is also possible to be carried out thering is identical work( The plug-in unit of other programs of energy, functional module or hardware device are it is preferred that above-mentioned plug-in unit and functional module can be by third parties Exploitation, and hardware device can be to run one of the terminal unit of described browser part, or, the combination of several part. Connection unit 304, during for the entity in the current browser opened for principal, principal and server is carried out even Connect;Shared cell 306, for sharing to from entity the connection set up between principal and server so that passing through even from entity Connect and carry out message transmission with server.
In above-mentioned preferred embodiment, when user opens multiple browser, in each browser, it is used for perform script The entity of program can go to compete preempting resources identifier, wherein, robs the entity accounting for resource identifier as principal, this main reality Body just becomes the main body sending and receiving message, and other does not rob the entity accounting for resource identifier as from entity, from entity Carry out message transmission with principal.So all of entity all can be shared this linkup transmit and receive message, solve existing Under the negligible amounts of the server connection browser being led to due to buffer size restriction in technology, the efficiency of service of server The problem of fall, has reached the shared effect of the long connection connecting between multiple browsers.
The application is also improved to above-mentioned shared cell 306, with realize from entity share principal and server it Between the connection set up to carry out the technique effect of message transmission with server, specifically, as shown in figure 4, shared cell 306 wraps Include:First receiver module 402, during for the entity in the current browser opened for principal, the reception server sends Message;Group broadcasting module 404, for by the message receiving multicast give principal be located at same multicast group in from reality Body.In above-mentioned preferably embodiment, principal is connected with server, and the message of the server of reception is sent to from reality Body is it is achieved that all of entity all can share message, and then has reached the shared effect of the long connection connecting between multiple browsers Really.
The application is also improved to above-mentioned group of broadcasting module 404, with realize principal by the message receiving multicast to With principal be located at same multicast group in from entity.Specifically, as shown in figure 5, this group broadcasting module 404 includes:Obtain son Module 502, is when the entity for the entity in the current browser opened, and obtains the mark in the message of principal multicast Know, wherein, identify for unique mark from one of entity;Judging submodule 504, for judging the mark from entity itself Whether consistent with the mark in the message of principal multicast, if unanimously, judge that the message of principal multicast is belonging to itself , and store message.In technique scheme, judged by the mark the message of acquisition principal multicast from entity That whether the disappearance of multicast belongs to itself it is ensured that the correct transmission of message.
The application is also improved to said apparatus, specifically, as shown in fig. 6, this device also includes:Preemption unit 602, it is when the entity for the entity in the current browser opened, after principal is attached with server, Every predetermined period preempting resources identifier;Converting unit 604, in preempting resources identifier, successfully and principal occurs When abnormal, by rob account for resource identifier be changed into new principal from entity, abnormal principal occurs and is changed into from entity.On State in preferred technical scheme, from entity every predetermined period preempting resources identifier, when principal abnormal so that When principal exception or is closed by the user, there is the new principal that can occupy resource identifier in entity it is ensured that information Normally interact.
The application has also carried out further improvement to said apparatus, specifically, as shown in fig. 7, this device also includes:The Two judging units 702, during for the entity in the current browser opened for principal, judge whether principal adds Multicast group;3rd judging unit 704, for when principal is not added to multicast group, judging to whether there is group in shared file Broadcast the multicast group name of group;First addition unit 706, for judging to exist multicast in shared file in the 3rd judging unit 704 During the multicast group name of group, principal is added multicast group by multicast group name according to present in shared file;First creates list Unit 708, for when the 3rd judging unit 704 judges the multicast group name that there is not multicast group in shared file, creating and being used for The multicast group name of unique mark multicast group, by the multicast group name creating write shared file, and according to the multicast group creating Principal is added multicast group by title.By above-mentioned preferred embodiment, there is provided a kind of specific principal is added to group The method broadcasting group, and then ensure that principal can be multicast to the message receiving in all of entity using multicast group.
The application has also carried out further improvement to said apparatus, specifically, as shown in figure 8, this device also includes:The Four judging units 802, are when the entity for the entity in the current browser opened, judge whether add from entity Multicast group;5th judging unit 804, for when entity is not added to multicast group, judging to whether there is multicast in shared file The multicast group name of group;Second addition unit 806, for judging to exist multicast group in shared file in the 5th judging unit 804 Multicast group name when, multicast group name according to present in shared file will add multicast group from entity;Acquiring unit 808, For when the 5th judging unit 804 judges the multicast group name that there is not multicast group in shared file, being provided according to principal The method of the multicast group name of acquisition multicast group obtain the multicast group name of multicast group, the multicast group name write that will obtain is altogether Enjoy in file, and multicast group will be added from entity according to the multicast group name obtaining.By above-mentioned preferred embodiment, provide A kind of method being specifically added to multicast group from entity can utilize multicast group it is ensured that can receive principal from entity The message of multicast.
The application has also carried out further improvement to above-mentioned shared cell 306, with reach from entity share principal with The connection set up between server to carry out the effect of message transmission with server, specifically, as shown in figure 9, shared cell 306 Including:Second receiver module 902, during for the entity in the current browser opened for principal, receives each from reality According to sending the message that message approach sends, wherein, send message approach is provided body by principal;Sending module 904, for root According to sending message approach, the message of reception is sent to server.In above-mentioned preferred embodiment, by sharing master from entity The connection set up between entity and server to carry out message transmission with server so that carrying out message biography from entity and principal Pass, and then realize the long connection connecting between multiple browsers and share.
Herein it should be noted that above-mentioned first judging unit 302, the second judging unit 702, the 3rd judging unit 704, 4th judging unit 802 and the 5th judging unit 804 can be separate judging unit or same judgement list Unit;Above-mentioned first addition unit 706 and the second addition unit 806 can be separate addition units or same Individual addition unit;Above-mentioned first receiver module 402 and the second receiver module 902 can be separate receiver modules, also may be used To be same receiver module.
Embodiment 3
On the basis of above-described embodiment 2, present invention also provides the connection sharing means between a kind of browser, specifically , Figure 10 shows the specific works mode of this device, in Fig. 10 as can be seen that when user opens multiple browser, often The entity being used for perform script program in individual browser can go to compete preempting resources identifier, and federation's only one of which entity can be robbed Account for successfully, this entity just becomes the main body sending and receiving message, other entities all carry out message transmission with this entity.This The all of entity of sample all can be shared this linkup transmit and receive message.Specifically, comprise the steps:
The first step:Preempting resources identifier
As shown in figure 11, in the case of normal flow, the entity being used for perform script program in each browser can start One task, this task is used for attempting preempting resources identifier, using LocalConnection.connect (resource identification Symbol).Because identical resource identifier only has an entity can occupy, thus necessarily occur that only one of which entity accounts for There are resource identifier, referred to as principal, and other entity then can not occupy, referred to as from entity;Under abnormal flow process, in order to Can be fault-tolerant, prevent principal exception or be closed by the user, can continuously attempt to occupy resource identification with certain frequency from entity Symbol, once principal occurs extremely, then having one can occupy the principal that resource identifier becomes new from entity again.
Second step:Add multicast group
As shown in figure 12, when entity rob account for resource identifier and become principal after, need using multicast group receiving Message multicast to all of entity.Idiographic flow is as follows:
For principal:1) first judge whether to have added multicast group:If first switching on entity, then not addition group Broadcasting group, if becoming principal by from entity competition, then adding multicast group, if not adding multicast group, needing to add. 2) judge to whether there is multicast group name in ShareObject:First switch on entity or ShareObject deleted by user, Then do not exist, other situations all exist.If it does not exist, then needing to create uniquely identified multicast group name and write ShareObject, if it is present directly utilizing multicast group name to add multicast group, wherein it is preferred that adding multicast group to need To use GroupSpecifier class and the NetGroup class of flash.
For from entity:1) that newly opens does not all add multicast group from entity, and direct requirement adds.2) judge Whether there is multicast group name in ShareObject:Normal condition exists certainly, is created using multicast group name and adds same Individual multicast group;If there is no (as ShareObject is deleted by user), then enter abnormal flow process.3) abnormal flow process:Call master The method of the acquisition multicast group name that the LocalConnection of entity provides, takes the write of multicast group name ShareObject, and add same multicast group.
Wherein, unique multicast group name is in order to the other machines in the same network segment do not interfere with each other, and needs every Machine generates unique title it is preferred that the scheme using random 32 character strings can be taken.
3rd step:Message transmission
As shown in figure 13, each sends from the message of entity and calls LocalConnection.send (resource identifier, side Religious name, parameter), the transmission message approach being provided by principal sends message.Safeguard in the method and be connected with the length of server.
When there being message to be sent to principal, principal can be disappeared from entity multicast to all of by the multicast group creating before Breath.All of all can obtain, from entity, the message receiving, then filter to take to obtain one's own message.
Since it is desired that identifying the whether one's own entity of this message, each entity is needed to have a unique mark, excellent Choosing, can be completed by generating 32 character strings at random, so whole message body needs a kind of data structure supporting.For The message transmission of P2P, the agreement of itself has necessarily contained sender and the recipient of message, so substantially not needing extra Definition;For the message transmission of BS structure, need user oneself in server end and the identification of the client side of being transmitted.Preferably , can be as shown in the table.So far, the flow process sending and receiving message all completes, and all of entity and server Connect and only exist portion.
Field Description
text Message content
sender Sender, the unique mark specified by the entity sending message
As can be seen from the above description, the application achieves following technique effect:The scheme recorded due to the application Employ inter-process communication techniques between each entity, all of data is all transmitted in internal memory, so speed can be very Hurry up;This programme is not related to any technology relying on browser, entirely by the interprocess communication of flash, so well Get through various types of browser data to share;The all data of this programme directly operate in internal memory, so to data volume Limit using size than using big many of locally stored scheme;Technical scheme described in the application can be greatly reduced this The connection number that ground browser produces;The size of shared object (ShareObject) file will not be increased due to increasing of browser Greatly, can support that arbitrarily many browsers are shared in theory to connect, and performance does not have any change;For using flow data The application of (as video etc.) can also adopt to share flow data in this way, not any for the message size sending data Require.
From above-mentioned preferred embodiment as can be seen that when user opens multiple browser, the reality of each browser Know from experience and go to compete preempting resources identifier, wherein, rob the entity accounting for resource identifier as principal, this principal just becomes Send and receive the main body of message, other does not rob the entity accounting for resource identifier as from entity, from entity and principal Carry out message transmission.So all of entity all can share this linkup transmit and receive message, solve in prior art by The server limiting in buffer size and leading to connects asking of the efficiency of service decline of the negligible amounts of browser, server Topic, has reached the shared effect of the long connection connecting between multiple browsers.
Obviously, those skilled in the art should be understood that each module of above-mentioned the application or each step can be with general Computing device realizing, they can concentrate on single computing device, or be distributed in multiple computing devices and formed Network on, alternatively, they can be realized with the executable program code of computing device, it is thus possible to they are stored To be executed by computing device in the storage device, and in some cases, can be with different from shown in order execution herein The step going out or describing, or they are fabricated to respectively each integrated circuit modules, or by the multiple modules in them or Step is fabricated to single integrated circuit module to realize.So, the application is not restricted to any specific hardware and software combination.
The foregoing is only the preferred embodiment of the application, be not limited to the application, for the skill of this area For art personnel, the application can have various modifications and variations.All within spirit herein and principle, made any repair Change, equivalent, improvement etc., should be included within the protection domain of the application.

Claims (10)

1. the connection sharing method between a kind of browser is it is characterised in that include:
The entity being used for perform script program in each browser opened is seized to same resource identifier, its In, robbing and accounting for the entity of described resource identifier is principal, and other is not robbed and accounted for the entity of described resource identifier is from reality Body;
Described principal and server are attached;
The described connection sharing foundation between described principal and described server from entity to carry out message with described server Transmission;
The described connection sharing foundation between described principal and described server from entity to carry out message with described server The step of transmission includes:Described principal receives the message that described server sends;Described principal is by the message groups receiving Broadcast give described principal be located at same multicast group in from entity;
Or, the described connection sharing foundation between described principal and described server from entity to carry out with described server The step of message transmission includes:Described principal receives each described message sending from entity according to transmission message approach, its In, described transmission message approach is provided by described principal;Described principal sends message approach disappearing reception according to described Breath is sent to described server.
2. method according to claim 1 it is characterised in that described principal the message receiving multicast is given described What principal was located in same multicast group includes from the step of entity:
The described mark obtaining from entity the message of described principal multicast, wherein, described identifies for described in unique mark From one of entity;
Described from entity judge itself identify whether consistent with the mark the message of described principal multicast;
If consistent, described execution judges that the entity of step judges that the message of described principal multicast is belonging to itself,
And store described message.
3. method according to claim 1 is it is characterised in that after described principal is attached with server, go back Including:
Described seize described resource identifier from entity every predetermined period;
If seize described resource identifier success and described principal appearance exception, rob and account for described resource identifier It is changed into new principal from entity, abnormal principal occurs and is changed into from entity.
4. method according to claim 1 is it is characterised in that described principal is added to multicast group by following steps In:
Described principal judges whether to add multicast group;
If not being added in described multicast group, described principal judges to whether there is the multicast of described multicast group in shared file Group name;
If there is the multicast group name of described multicast group, described principal multicast group name according to present in described shared file Claim to add described multicast group;
If there is not the multicast group name of described multicast group, described principal creates the group for multicast group described in unique mark Broadcast group name, the multicast group name creating is write described shared file, and institute is added according to the multicast group name of described establishment State multicast group.
5. method according to claim 1 is it is characterised in that described be added to multicast group from entity by following steps In:
Described judge whether to add multicast group from entity;
If not being added in described multicast group, described from entity judge shared file whether there is described multicast group multicast Group name;
If there is the multicast group name of described multicast group, described from entity multicast group name according to present in described shared file Claim to add described multicast group;
If there is not the multicast group name of described multicast group, described described group of the acquisition being provided according to described principal from entity The method broadcasting the multicast group name of group obtains the multicast group name of described multicast group, will be described common for the multicast group name obtaining write Enjoy in file, and described multicast group is added according to the multicast group name of described acquisition.
6. the connection sharing means between a kind of browser are it is characterised in that include:
First judging unit, whether the entity for judging perform script program in the current browser opened is principal, Wherein, the entity in the described current browser opened is seized to same resource identifier, robs and accounts for described resource The entity of identifier is principal, and other is not robbed and accounted for the entity of described resource identifier is from entity;
Connection unit, during for the entity in the current browser opened for principal, by described principal and server It is attached;
Shared cell, for by the connection set up between described principal and described server share to described from entity so that institute State, from entity, message transmission is carried out with described server by described connection;
Described shared cell includes:First receiver module, during for the entity in the current browser opened for principal, Receive the message that described server sends;Group broadcasting module, for giving described principal positioned at same by the message receiving multicast In one multicast group from entity;
Or, described shared cell includes:Second receiver module, for real based on the entity in the current browser opened During body, receive each described message sending from entity according to transmission message approach, wherein, described transmission message approach is by described Principal provides;Sending module, for being sent to described server according to described transmission message approach by the message of reception.
7. device according to claim 6 is it is characterised in that described group of broadcasting module includes:
Acquisition submodule, is when the entity for the entity in the current browser opened, and obtains described principal multicast Message in mark, wherein, described identify for described in unique mark from one of entity;
Judging submodule, for judging described identifying whether and the mark the message of described principal multicast from entity itself Unanimously, if unanimously, judge that the message of described principal multicast is belonging to itself, and store described message.
8. device according to claim 6 is it is characterised in that also include:
Preemption unit, is when the entity for the entity in the current browser opened, in described principal and server After being attached, seize described resource identifier every predetermined period;
Converting unit, for when seizing described resource identifier success and described principal abnormal, robbing described in accounting for Resource identifier be changed into new principal from entity, abnormal principal occurs and is changed into from entity.
9. device according to claim 6 is it is characterised in that also include:
Second judging unit, during for the entity in the current browser opened for principal, judges that described principal is No add multicast group;
3rd judging unit, for when described principal is not added to described multicast group, judging to whether there is in shared file The multicast group name of described multicast group;
First addition unit, for judging the multicast that there is described multicast group in described shared file in described 3rd judging unit During group name, described principal is added described multicast group by multicast group name according to present in described shared file;
First creating unit, for judging the group that there is not described multicast group in described shared file in described 3rd judging unit When broadcasting group name, create the multicast group name for multicast group described in unique mark, will be described for the multicast group name creating write Shared file, and described principal is added by described multicast group according to the multicast group name of described establishment.
10. device according to claim 6 is it is characterised in that also include:
4th judging unit, is when the entity for the entity in the current browser opened, judge described in from entity be No add multicast group;
5th judging unit, for described when entity is not added to described multicast group, judges to whether there is institute in shared file State the multicast group name of multicast group;
Second addition unit, for judging the multicast that there is described multicast group in described shared file in described 5th judging unit During group name, multicast group name according to present in described shared file adds described multicast group by described from entity;
Acquiring unit, for judging the multicast group that there is not described multicast group in described shared file in described 5th judging unit During title, the method for the multicast group name of the described multicast group of acquisition being provided according to described principal obtains the group of described multicast group Broadcast group name, the multicast group name obtaining is write in described shared file, and according to the multicast group name of described acquisition by institute State and add described multicast group from entity.
CN201210046581.3A 2012-02-24 2012-02-24 Connection sharing method between browser and device Active CN103297455B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210046581.3A CN103297455B (en) 2012-02-24 2012-02-24 Connection sharing method between browser and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210046581.3A CN103297455B (en) 2012-02-24 2012-02-24 Connection sharing method between browser and device

Publications (2)

Publication Number Publication Date
CN103297455A CN103297455A (en) 2013-09-11
CN103297455B true CN103297455B (en) 2017-03-01

Family

ID=49097772

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210046581.3A Active CN103297455B (en) 2012-02-24 2012-02-24 Connection sharing method between browser and device

Country Status (1)

Country Link
CN (1) CN103297455B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105357116B (en) * 2015-10-23 2018-04-06 上海斐讯数据通信技术有限公司 A kind of method and intelligent terminal of multiple terminal access server
CN107957938A (en) * 2016-10-14 2018-04-24 北京酷我科技有限公司 A kind of method and system for obtaining website test data

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101621736A (en) * 2008-07-01 2010-01-06 华为技术有限公司 Method, client and server for acquiring service information
CN102098345A (en) * 2011-02-22 2011-06-15 深圳市同洲电子股份有限公司 Resource sharing method and service providing system
CN102291432A (en) * 2011-07-05 2011-12-21 广东威创视讯科技股份有限公司 Network information sharing method, device and client

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101621736A (en) * 2008-07-01 2010-01-06 华为技术有限公司 Method, client and server for acquiring service information
CN102098345A (en) * 2011-02-22 2011-06-15 深圳市同洲电子股份有限公司 Resource sharing method and service providing system
CN102291432A (en) * 2011-07-05 2011-12-21 广东威创视讯科技股份有限公司 Network information sharing method, device and client

Also Published As

Publication number Publication date
CN103297455A (en) 2013-09-11

Similar Documents

Publication Publication Date Title
CN107948324B (en) Request Transmission system, method, apparatus and storage medium
CN108200165B (en) Request Transmission system, method, apparatus and storage medium
CN104580192B (en) The treating method and apparatus of the network access request of application program
CN110048927B (en) Communication method and communication device
CN103329113B (en) Configuration is accelerated and custom object and relevant method for proxy server and the Dynamic Website of hierarchical cache
US11743328B2 (en) Computer-implemented system and method for propagation and communication of data in a network such as a blockchain network
CN108200158B (en) Request Transmission system, method, apparatus and storage medium
US20140280859A1 (en) Sharing control system and method for network resources download information
US10958735B2 (en) Client connection method and system
EP4054154A1 (en) Blockchain-based systems and methods for propagating data in a network
CN104809369B (en) Packet sets method, client, server and the system of equipment access rights
CN103188245A (en) Fight game server system
CN104010001B (en) In mobile terminal, the method and system connecting communication is carried out in similar networking request
CN109547524A (en) User behavior storage method, device, equipment and storage medium based on Physical Network
EP3794795A1 (en) Systems and methods for propagating data packets in a network of nodes
CN108989438A (en) Implementation method, the device and system of data distribution network
CN103297455B (en) Connection sharing method between browser and device
CN105653717B (en) A kind of method and device that information is shared
CN105991592A (en) Same-natural-person identity maintenance method and apparatus, and server
CN108829526A (en) A kind of inter-process communication methods, electronic equipment and readable storage medium storing program for executing
CN105100101A (en) Method, apparatus and system based on SSL session
CN103533001A (en) Communication method and communication system based on HTTP multi-proxy, and intermediate proxy server
CN103001942A (en) Virtual server and method for defending network attack
CN114615315A (en) Communication method, device, equipment and storage medium for online conversation
CN106101189A (en) Data transmission method and system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 1184931

Country of ref document: HK

GR01 Patent grant
GR01 Patent grant
REG Reference to a national code

Ref country code: HK

Ref legal event code: GR

Ref document number: 1184931

Country of ref document: HK