The content of the invention
The purpose of the application is to propose a kind of improved method and apparatus for pushing instant message, solve more thanThe technical problem that background section is mentioned.
In a first aspect, this application provides a kind of method for pushing instant message, the method includes:Receive long connectionThe instant message of server redirection, the wherein instant message are to set up the client collection that length is connected with the long connection serverThe instant message sent by client in conjunction;Determine the client terminal quantity of the client set;Relatively the client terminal quantity withFirst threshold, and the instant message is set to by corresponding type of message according to comparative result, wherein, the client terminal quantity is less thanOr corresponding type of message is reverse drawing pattern when being equal to first threshold, the client terminal quantity is more than corresponding message during first thresholdType is straight push-model;The instant message push for being arranged type of message is initiated to the visitor to the long connection serverThe remote procedure call of family end set.
In certain embodiments, this initiates to have been arranged the instant message push of type of message to the long connection serverTo the remote procedure call of the client set, including:Determine the client terminal quantity whether more than Second Threshold;If the clientQuantity is more than Second Threshold, then the client set is split into client of the multiple client quantity less than or equal to Second ThresholdExtremal subset;The instant message for initiating to have been arranged type of message to the long connection server pushes to each client child respectivelyMultiple remote procedure calls of collection.
In certain embodiments, this determines the client terminal quantity of the client set, including:Being determined according to log-on message shouldThe client terminal quantity of client set, wherein, the log-on message is in response to set up long company in the long connection server and clientWhat the client registers sent when connecing were asked and were generated.
Second aspect, this application provides another is used for the method for pushing instant message, the method includes:Receive and be somebody's turn to doThe instant message sent by the client that long connection server is set up in the client set of long connection;By the instant message weightIt is directed to message server;The message server is received after type of message is set to the instant message, having been arranged of initiatingThe remote procedure call of instant message push of type of message to the client set;The remote procedure call is performed with shouldInstant message push is to the client set;Wherein, the type of message is client of the message server to the client setWhat end quantity was compared with first threshold and the instant message was arranged according to comparative result, the client terminal quantity is less than firstDuring threshold value, corresponding type of message is reverse drawing pattern, and when the client terminal quantity is more than first threshold, corresponding type of message is directly to push awayPattern.
In certain embodiments, the reception message server after to the instant message, type of message is set, initiateThe remote procedure call of instant message push of type of message to the client set has been set, including:Receive the messageMultiple remote procedure calls that server sends, wherein, each remote procedure call is respectively used to arranged type of messageThe different clients extremal subset of the instant message push to the client set, the client subset are the message servers in the visitorClient terminal quantity obtained by the client terminal quantity of family end set is divided to the client set when being more than Second Threshold is littleIn the client subset of Second Threshold;And the execution remote procedure call with by the instant message push to the client collectionClose, including:The plurality of remote procedure call is performed successively with sequentially by the instant message push to the multiple of the client setClient subset.
In certain embodiments, the method also includes client registers step, and the client registers step includes:With clientLong connection is set up at end;Client registers request is sent to the message server, so that the message server generates log-on message, shouldLog-on message determines the client terminal quantity of the client set for the message server.
In certain embodiments, length should be set up with client to be connected, including:Set up with client using scheduling agent threadCommunication connection;Line is performed from selection agency in execution thread set is acted on behalf of according to equally loaded strategy using the scheduling agent threadJourney, and the connection handle of the communication connection set up is write into the selected connection queue for acting on behalf of execution thread;UseThe scheduling agent thread sends trigger message to the selected pipeline for acting on behalf of execution thread;Execution thread response is acted on behalf of using thisIn the trigger message is received, connection handle is read from the connection queue, to take over the corresponding communication connection of connection handle.
In certain embodiments, the execution remote procedure call to be to push the information to the client set, including:MakeExecution thread is pushed from selection in execution thread set is pushed according to equally loaded strategy with scheduling thread is pushed, and this is instantIn message and the remote procedure call, the client-side information of client to be pushed distributes to selected push execution thread;MakeThe instant message and the client-side information are forwarded to into the scheduling agent thread with the push execution thread;Adjusted using the agencyDegree thread inquire about in the connection queue it is corresponding with client-side information connect handle place act on behalf of execution thread, and by this beWhen message be transferred to this and act on behalf of execution thread;Using this act on behalf of execution thread should by the corresponding communication connection of connection handleInstant message is sent to corresponding client.
The third aspect, this application provides a kind of device for pushing instant message, the device includes:Receiving unit,For receiving the instant message that long connection server is redirected, the wherein instant message is to have set up length with the long connection serverThe instant message sent by client in the client set of connection;Determining unit, for determining the visitor of the client setFamily end quantity;The instant message for comparing the client terminal quantity and first threshold, and is set by setting unit according to comparative resultCorresponding type of message is set to, wherein, when the client terminal quantity is less than or equal to first threshold, corresponding type of message is reverse drawingPattern, when the client terminal quantity is more than first threshold, corresponding type of message is straight push-model;Unit is initiated, for connecting to the lengthConnect server to initiate for being arranged the remote procedure call of instant message push of type of message to the client set.
In certain embodiments, the initiation unit, including:Determination subelement, for determining whether the client terminal quantity is bigIn Second Threshold;Subelement is split, if being more than Second Threshold for the client terminal quantity, the client set is split into manyClient subset of the individual client terminal quantity less than or equal to Second Threshold;Subelement is initiated, for sending out to the long connection serverRise and the instant message of type of message has been set pushes to multiple remote procedure calls of each client subset respectively.
In certain embodiments, the determination subelement is further used for:The client set is determined according to log-on messageClient terminal quantity, wherein, the log-on message is in response to the visitor sent when the long connection server and client set up long connectionFamily end registration request and generate.
Fourth aspect, this application provides a kind of device for pushing instant message, the device includes:Message sink listUnit, what the client set up in the client set that length is connected for reception and the long connection server was sent disappear immediatelyBreath;Unit is redirected, for the instant message is redirected to message server;Receiving unit is called, for receiving the messageServer is after type of message is arranged to the instant message, instant message push for having been arranged type of message of initiation extremely shouldThe remote procedure call of client set;Performance element, for perform the remote procedure call with by the instant message push extremelyThe client set;Wherein, the type of message is client terminal quantity and first threshold of the message server to the client setWhat value was compared and the instant message was arranged according to comparative result, the client terminal quantity is corresponding when being less than first threshold to disappearBreath type is reverse drawing pattern, and when the client terminal quantity is more than first threshold, corresponding type of message is straight push-model.
In certain embodiments, this calls receiving unit to be further used for:Receive that the message server sends is multiple remoteThe journey invocation of procedure, wherein, each remote procedure call is respectively used to arranged the instant message push of type of message and extremely shouldThe different clients extremal subset of client set, the client subset are number clients of the message server in the client setClient of the client terminal quantity obtained by being divided to the client set when amount is more than Second Threshold less than Second ThresholdSubset;And the performance element is further used for:Perform the plurality of remote procedure call successively sequentially to push away the instant messageIt is sent to the multiple client subset of the client set.
In certain embodiments, the device also includes client registers unit, and the client registers unit includes:Long connectionSubelement is set up, and is connected for length being set up with client;Request subelement, for sending client registers to the message serverRequest, so that the message server generates log-on message, the log-on message determines the client set for the message serverClient terminal quantity.
In certain embodiments, the long connection establishment subelement is further used for:Using scheduling agent thread and clientSet up communication connection;Held from selection agency in execution thread set is acted on behalf of according to equally loaded strategy using the scheduling agent threadLine journey, and the connection handle of the communication connection set up is write into the selected connection queue for acting on behalf of execution thread;Trigger message is sent to the selected pipeline for acting on behalf of execution thread using the scheduling agent thread;Execution thread is acted on behalf of using thisIn response to receiving the trigger message, connection handle is read from the connection queue, to take over the corresponding communication link of connection handleConnect.
In certain embodiments, the performance element is further used for:Using push scheduling thread according to equally loaded strategyExecution thread is pushed from pushing, and will wait to push in the instant message and the remote procedure callThe client-side information of client distributes to selected push execution thread;Using the push execution thread by the instant message withAnd the client-side information is forwarded to the scheduling agent thread;Inquired about and client in the connection queue using the scheduling agent threadWhat the corresponding connection handle of client information was located acts on behalf of execution thread, and the instant message is transferred to this acts on behalf of execution thread;MakeExecution thread is acted on behalf of with this instant message to be sent to corresponding client by the corresponding communication connection of the connection handle.
The application provide for the method and apparatus that pushes instant message, by setting up the client that length is connected with serverEnd quantity determines that the pattern for pushing instant message is reverse drawing pattern or straight push-model, so that the push mould of instant messagesFormula can match current scene, can meet the different transmission requirements to instant message under different scenes.
Specific embodiment
With reference to the accompanying drawings and examples the application is described in further detail.It is understood that this place is retouchedThe specific embodiment stated is used only for explaining related invention, rather than the restriction to the invention.It also should be noted that, in order toBe easy to description, illustrate only in accompanying drawing to about the related part of invention.
It should be noted that in the case where not conflicting, the feature in embodiment and embodiment in the application can phaseMutually combine.Below with reference to the accompanying drawings and in conjunction with the embodiments describing the application in detail.
Fig. 1 shows the method for pushing instant message or the dress for pushing instant message that can apply the applicationThe exemplary system architecture 100 of the embodiment put.
As shown in figure 1, system architecture 100 can include terminal unit 101,102,103, network 104,106, long connection clothesBusiness device 105 and message server 107.Network 104 in terminal unit 101,102,103 and long connection server 105 andThe medium of communication link is provided between long connection server 105 and message server 107.Network 104,106 can include eachPlant connection type, such as wired, wireless communication link or fiber optic cables etc..
User can be interacted with server 105 by network 104 with using terminal equipment 101,102,103, to receive or send outSend message etc..Various telecommunication customer end applications can be installed on terminal unit 101,102,103, such as net cast class shouldWith, JICQ, mailbox client, social platform software etc..
Terminal unit 101,102,103 can be with display screen and the various electronic equipments that browse of supported web page, bagInclude but be not limited to smart mobile phone, panel computer, E-book reader, MP3 player (Moving Picture ExpertsGroup Audio Layer III, dynamic image expert's compression standard audio frequency aspect 3), MP4 (Moving PictureExperts Group Audio Layer IV, dynamic image expert's compression standard audio frequency aspect 4) player, on knee portableComputer and desk computer etc..
Long connection server 105 can be to provide the server of various services, can connect from terminal unit 101,102,103The collection of letters ceases and is redirected to message server 107, and message server 107 can transmit the message to length after processing to informationConnection server 105, sends information to terminal unit 101,102,103 by long connection server 105.
It should be noted that the method for pushing instant message provided by Fig. 2 correspondence embodiments is typically taken by messageBusiness device 107 is performed, and correspondingly, the device for pushing instant message shown in Fig. 5 is generally positioned in message server 107;The method for pushing instant message provided by Fig. 3 correspondence embodiments is typically performed by long connection server 105, correspondingly,The device for pushing instant message shown in Fig. 6 is generally positioned in long connection server 105.
It should be understood that the number of the terminal unit, network and server in Fig. 1 is only schematic.According to realizing needWill, can have any number of terminal unit, network and server.
With continued reference to Fig. 2, the stream for pushing one embodiment of the method for instant message according to the application is shownJourney 200.This is used for the method for pushing instant message, comprises the following steps:
Step 201, receives the instant message that long connection server is redirected.
In the present embodiment, the method for pushing instant message runs electronic equipment thereon (such as shown in Fig. 1Message server) wired connection mode or radio connection can be passed through from long connection server reception instant message.ShouldInstant message can be set up the client that length be connected with the long connection server and send, the message can be word, picture,The various message such as sound, audio or video.Long connection server, can be by the instant message weight after the instant message is receivedIt is directed to electronic equipment (i.e. message server).Long connection, refers to and can continuously transmit multiple packets in a connection, evenDuring connecing holding, if no packet sends, both sides are needed to send out link detecting bag.
Generally, user browsed using social networking applications such as the JICQs or net cast platform installed in terminal andInteractive information, at this moment, user can directly input information by the social networking application.
Step 202, determines the client terminal quantity of client set.
In the present embodiment, electronic equipment can determine the visitor being connected with long connection server foundation length by various modesThe client terminal quantity of family end set.
In some optional implementations of the present embodiment, step 202 can include:Client is determined according to log-on messageThe client terminal quantity of set, wherein, log-on message is in response to set up what is sent when length is connected in long connection server and clientWhat client registers were asked and were generated.
Step 203, compares client terminal quantity and first threshold, and is set to instant message according to comparative result correspondingType of message.
In the present embodiment, run can first by base on electronic equipment thereon for the method for pushing instant messageClient terminal quantity obtained by step 203 is compared with first threshold.Afterwards, electronic equipment can be incited somebody to action according to comparative resultInstant message is set to corresponding type of message.Wherein, corresponding message class when client terminal quantity is less than or equal to first thresholdType is reverse drawing pattern, and when client terminal quantity is more than first threshold, corresponding type of message is straight push-model.Reverse drawing pattern and directly push awayPattern is two kinds of different transfer modes of instant message.Reverse drawing pattern is that, when there is new information to produce, service end is to current onlineClient send one notice, after client is notified, actively to service end ask new information data.Reverse drawing pattern,Can ensure that accuracy, the timing of message dilivery, but the more than once network interaction of the push of a piece of news, increase messageThe time delay of transmission, while one times of access pressure is also increased to server.A piece of news is being pushed to client by straight push-modelOnly have primary network to interact during end, the push pressure of back-end server is less, delay is low, but occur in service peak period and disappearBreath is lost, the problem of sequential entanglement.Straight push-model, then, when being have new information to produce, message body is directly pushed to by service endThe client of line, service end and client need not carry out delivering successfully confirmation, belong to " transmitting as possible ".
Step 204, initiates instant message push for being arranged type of message to client to long connection serverThe remote procedure call of set.
In the present embodiment, based on execution step 203 obtained by the instant message that type of message is set, electronic equipmentCan initiate for being arranged the long-range mistake of the instant message push of type of message to client set to long connection serverJourney is called.
In some optional implementations of the present embodiment, step 204 can include:Determine whether client terminal quantity is more thanSecond Threshold;If client terminal quantity be more than Second Threshold, by client set split into multiple client quantity be less than or waitIn the client subset of Second Threshold;The instant message for initiating to have been arranged type of message to long connection server is pushed to respectivelyMultiple remote procedure calls of each client subset.
The method that above-described embodiment of the application is provided, is pushed away by setting up the long client terminal quantity determination being connected with serverThe pattern for sending instant message is reverse drawing pattern or straight push-model, so that the push mode of instant messages can be matched working asFront scene, can meet the different transmission requirements to instant message under different scenes.
With further reference to Fig. 3, it illustrates for pushing the flow process 300 of another embodiment of the method for instant message.This is used for the flow process 300 of the method for pushing instant message, comprises the following steps:
Step 301, receives what the client set up in the client set that length is connected with long connection server was sentInstant message.
In the present embodiment, the method for pushing instant message runs electronic equipment thereon (such as shown in Fig. 1Long connection server) wired connection mode or radio connection can be passed through carry out the end of information exchange using which from userEnd receives instant message.
Instant message is redirected to message server by step 302.
In the present embodiment, the instant message received by step 301 can be redirected to messenger service by electronic equipmentDevice.
Step 303, receive message server to instant message arrange type of message after, initiate message class has been setThe remote procedure call of the instant message push of type to client set.
In the present embodiment, the instant message of message server is redirected to based on step 302, message server can be rightThe client terminal quantity of client set is compared with first threshold and arranges message class to the instant message according to comparative resultType.Wherein, when client terminal quantity is less than first threshold, corresponding type of message is reverse drawing pattern, and client terminal quantity is more than theDuring one threshold value, corresponding type of message is straight push-model.Afterwards, message server can initiate to arrange to disappear to electronic equipmentThe remote procedure call of the instant message push to client set of breath type.Thus, it is long-range to receive this by electronic equipmentThe invocation of procedure.
Step 304, perform remote procedure call with by instant message push to client set.
In the present embodiment, based on the remote procedure call received by step 303, it is long-range that electronic equipment can perform thisThe invocation of procedure, such that it is able to be set the instant message push of type of message to client set.For type of messageFor the instant message of straight push-model, the message content of instant message is directly pushed to each client by long connection server, objectiveFamily end can show message content.For the instant message that type of message is straight push-model, long connection server can first byThe new information of instant message pushes to each client, and client can be sent out to long connection server new information is receivedSend the increment to new instant message to pull request so that long connection server receive pull request to increment after again toThe message content of client push instant message.
In some optional implementations of the present embodiment, above-mentioned steps 303 can include:Receive message server to sendMultiple remote procedure calls, wherein, each remote procedure call is respectively used to arranged the instant message of type of message and pushes awayThe different clients extremal subset of client set is delivered to, client subset is client terminal quantity of the message server in client setThe client subset of Second Threshold is less than more than the client terminal quantity obtained by being divided to client set during Second Threshold.Additionally, step 304 can include:Multiple remote procedure calls are performed successively with sequentially by instant message push to client setMultiple client subset.
In some optional implementations of the present embodiment, said method also includes client registers step, the clientRegistration step includes:Length is set up with client to be connected;Client registers request is sent to message server, so that message serverLog-on message is generated, log-on message determines the client terminal quantity of client set for message server.
It is in some optional implementations of the present embodiment, above-mentioned to be connected with client foundation length, including:Adjusted using agencyDegree thread sets up communication connection with client;Using scheduling agent thread according to equally loaded strategy from acting on behalf of execution thread setExecution thread is acted on behalf of in middle selection, and the connection handle of the communication connection set up is write to selected execution thread of acting on behalf ofIn connection queue;Trigger message is sent to the selected pipeline for acting on behalf of execution thread using scheduling agent thread;Using agencyExecution thread reads connection handle from connection queue in response to receiving trigger message, to take over the corresponding communication of connection handleConnection.Wherein, load balancing is to share to be performed task on multiple operating units, so as to complete jointly task.Specific load-balancing algorithm can be polling method, randomized, source address Hash method, WRR method, in Smallest connection number methodAny one.
During Fig. 4 a show the implementation, long connection server sets up the interactive schematic diagram that length is connected with client.As schemedShown in 4a, this process may include steps of:First, the scheduling agent thread in long connection server 402 (can be named asProxy_dispatcher) 4021 communication connection can be set up with client;Secondly, scheduling agent thread 4021 can be according to negativeCarry balance policy and select in execution thread 4023 from acting on behalf of execution thread (proxy_worker can be named as) 4022 and act on behalf ofAct on behalf of execution thread 4023 and the connection handle of the communication connection set up is write to the connection queue of execution thread 4023;Connect, scheduling agent thread 4021 can send information to the pipeline of execution thread 4023 and be connected with triggering to act on behalf of execution thread and readConnection handle in queue;Afterwards, above-mentioned communication connection is taken over by reading connection handle by acting on behalf of execution thread 4023.Such asThis, long connection server 402 can finally set up long connection server with client.Additionally, after long connection is set up, agency holdsLine journey 4023 can also adjust back the service provided by message server 404 please to send registration to readjustment message server 404Ask, so as to the client to setting up long connection in message server 404 is registered, generate log-on message.
In some optional implementations of the present embodiment, above-mentioned steps 304 can include:Using push scheduling thread rootExecution thread is pushed from selection in execution thread set is pushed according to equally loaded strategy, and instant message and remote process are adjustedWith in, the client-side information of client to be pushed distributes to selected push execution thread;Will be instant using execution thread is pushedMessage and client-side information are forwarded to scheduling agent thread;Inquired about and client in connection queue using scheduling agent threadWhat the corresponding connection handle of information was located acts on behalf of execution thread, and instant message is transferred to acts on behalf of execution thread;Using agencyExecution thread is sent instant message to corresponding client by connecting the corresponding communication connection of handle.
Fig. 4 b show interactive schematic diagram during PUSH message in the implementation.First, when user passes through client 401When sending instant message in the groups of users of place, client 401 is by the instant message by built with long connection server 402Vertical long linkup transmit acts on behalf of execution thread 4023 to corresponding in long connection server 402.Then, long connection server 402Execution thread 4023 of acting on behalf of the instant message is redirected to into message server 403.Message server 403 by one can beRow operation setting type of message simultaneously initiates instant message push for being arranged type of message extremely to long connection server 402The remote procedure call of client set.Wherein, above-mentioned sequence of operations can include:By log-on message inquiring client terminal collectionThe client terminal quantity of conjunction;Judge that type of message, whether more than 500, is set to straight push-model if being more than by client terminal quantity, ifType of message is set to into reverse drawing pattern then no more than;Afterwards, message server 403 may determine that whether client terminal quantity is more than4000, adjust if the remote process that the instant message push to client set to arranging type of message is directly initiated less than ifWith the task subset of each client subset being submitted to after client set is split into 10 client subsets more than ifMessage queue is simultaneously issued to push task.The operation for wherein splitting can be performed repeatedly until each client child concentrates clientQuantity is less than 4000.When remote procedure call is initiated, message server 403 can have been arranged the instant message of type of messageAnd the client-side information of the client set for being pushed sends to the push scheduling thread of long connection server 402 and (can nameFor push_dispatcher) 4024, push scheduling thread 4024 can according to equally loaded strategy from push execution thread (canBe named as push_worker) 4025 and push execution thread 4026 select push execution thread 4025 and by client-side information andInstant message distributes to push execution thread 4025.Afterwards, in push process push execution thread 4025 can pass through intoIs communicated between journey and client-side information and instant message are transmitted to scheduling agent thread 4021, scheduling agent thread 4021 can basisClient-side information select it is corresponding act on behalf of execution thread 4022 and instant message be transferred to act on behalf of execution thread 4022.Finally,Act on behalf of execution thread 4022 to communicate to connect instant message push to client 402 by corresponding.
From figure 3, it can be seen that determining push instant message by setting up the long client terminal quantity being connected with serverPattern is reverse drawing pattern or straight push-model, so that the push mode of instant messages can match current scene, energyMeet the different transmission requirements to instant message under different scenes.
With further reference to Fig. 5, as the realization to method shown in above-mentioned each figure, this application provides one kind for pushing isWhen message device one embodiment, the device embodiment is corresponding with the embodiment of the method shown in Fig. 2, and the device specifically may be usedTo be applied in various electronic equipments.
As shown in figure 5, the device 500 for pushing instant message described by the present embodiment includes:Receiving unit 501,Determining unit 502, setting unit 503 and initiation unit 504.Wherein, receiving unit 501 is reset for receiving long connection serverTo instant message, wherein instant message is the client institute set up in the client set that is connected of length with long connection serverThe instant message of transmission;Determining unit 502 is used for the client terminal quantity for determining client set;Setting unit 503 is used to compareClient terminal quantity and first threshold, and instant message is set to by corresponding type of message according to comparative result, wherein, clientWhen quantity is less than or equal to first threshold, corresponding type of message is reverse drawing pattern, and client terminal quantity is more than corresponding during first thresholdType of message be straight push-model;And unit 504 is initiated for initiating for being arranged type of message to long connection serverInstant message push to client set remote procedure call.
In the present embodiment, for pushing the receiving unit 501 of the device 500 of instant message, determining unit 502, arrangeUnit 503 and initiate the step 201, step 202, step that the concrete process of unit 504 may be referred in the corresponding embodiments of Fig. 2203 and step 204, repeat no more here.
In some optional implementations of the present embodiment, unit 504 is initiated, including:Determination subelement (not shown), usesIn it is determined that whether client terminal quantity is more than Second Threshold;Subelement (not shown) is split, if being more than second for client terminal quantityThreshold value, then split into client subset of the multiple client quantity less than or equal to Second Threshold by client set;Initiate sonUnit (not shown), the instant message for initiating to have been arranged type of message to long connection server push to each visitor respectivelyMultiple remote procedure calls of family extremal subset.
In some optional implementations of the present embodiment, determination subelement is further used for:Determined according to log-on messageThe client terminal quantity of client set, wherein, log-on message is in response to when long connection server and client are set up length and be connectedWhat the client registers of transmission were asked and were generated.
With further reference to Fig. 6, as the realization to method shown in above-mentioned each figure, this application provides one kind for pushing isWhen message device one embodiment, the device embodiment is corresponding with the embodiment of the method shown in Fig. 4, and the device specifically may be usedTo be applied in various electronic equipments.
As shown in fig. 6, the device 600 for pushing instant message described by the present embodiment includes:Message reception units601st, redirect unit 602, call receiving unit 603 and performance element 604.Wherein, message reception units 601 be used for receive withThe instant message sent by the client that long connection server is set up in the client set of long connection;Redirect unit 602For instant message is redirected to message server;Receiving unit 603 is called for message server being received to disappearing immediatelyThe remote process of the instant message push for having been arranged type of message to client set cease after arranging type of message, initiated is adjustedWith;And performance element 604 is used to perform remote procedure call with by instant message push to client set, wherein, message classType is that message server is compared with first threshold to the client terminal quantity of client set and according to comparative result to instantWhat message was arranged, when client terminal quantity is less than first threshold, corresponding type of message is reverse drawing pattern, and client terminal quantity is more than theDuring one threshold value, corresponding type of message is straight push-model.
In the present embodiment, for push the device 600 of instant message message reception units 601, redirect unit602nd, receiving unit 603 and the concrete process of performance element 604 is called to may be referred to the step 401 in the corresponding embodiments of Fig. 4, stepRapid 402, step 403 and step 404, are repeated no more here.
In some optional implementations of the present embodiment, receiving unit 603 is called to be further used for:Receive messenger serviceMultiple remote procedure calls that device sends, wherein, each remote procedure call is respectively used to arranged the instant of type of messageMessage pushes to the different clients extremal subset of client set, and client subset is client of the message server in client setClient of the client terminal quantity obtained by being divided to client set when end quantity is more than Second Threshold less than Second ThresholdExtremal subset;And performance element 604 is further used for:Multiple remote procedure calls are performed successively with sequentially by instant message pushTo the multiple client subset of client set.
In some optional implementations of the present embodiment, device also includes client registers unit, client registers listUnit includes:Long connection establishment subelement, is connected for setting up length with client;Request subelement, for sending out to message serverGo out client registration request, so that message server generates log-on message, log-on message determines client collection for message serverThe client terminal quantity of conjunction.
In some optional implementations of the present embodiment, long connection establishment subelement is further used for:Adjusted using agencyDegree thread sets up communication connection with client;Using scheduling agent thread according to equally loaded strategy from acting on behalf of execution thread setExecution thread is acted on behalf of in middle selection, and the connection handle of the communication connection set up is write to selected execution thread of acting on behalf ofIn connection queue;Trigger message is sent to the selected pipeline for acting on behalf of execution thread using scheduling agent thread;Using agencyExecution thread reads connection handle from connection queue in response to receiving trigger message, to take over the corresponding communication of connection handleConnection.
In some optional implementations of the present embodiment, performance element is further used for:Using push scheduling thread rootExecution thread is pushed from selection in execution thread set is pushed according to equally loaded strategy, and instant message and remote process are adjustedWith in, the client-side information of client to be pushed distributes to selected push execution thread;Will be instant using execution thread is pushedMessage and client-side information are forwarded to scheduling agent thread;Inquired about and client in connection queue using scheduling agent threadWhat the corresponding connection handle of information was located acts on behalf of execution thread, and instant message is transferred to acts on behalf of execution thread;Using agencyExecution thread is sent instant message to corresponding client by connecting the corresponding communication connection of handle.
Below with reference to Fig. 7, the calculating for being suitable to terminal unit or server for realizing the embodiment of the present application is it illustratesThe structural representation of machine system 700.
As shown in fig. 7, computer system 700 includes CPU (CPU) 701, which can be read-only according to being stored inProgram in memorizer (ROM) 702 or be loaded into the program in random access storage device (RAM) 703 from storage part 708 andPerform various appropriate actions and process.In RAM 703, the system that is also stored with 700 operates required various programs and data.CPU 701, ROM 702 and RAM 703 are connected with each other by bus 704.Input/output (I/O) interface 705 is also connected to alwaysLine 704.
I/O interfaces 705 are connected to lower component:Including the importation 706 of keyboard, mouse etc.;Penetrate including such as negative electrodeThe output par, c 707 of spool (CRT), liquid crystal display (LCD) etc. and speaker etc.;Storage part 708 including hard disk etc.;And the communications portion 709 of the NIC including LAN card, modem etc..Communications portion 709 via such as becauseThe network of special net performs communication process.Driver 710 is also according to needing to be connected to I/O interfaces 705.Detachable media 711, such asDisk, CD, magneto-optic disk, semiconductor memory etc., as needed in driver 710, in order to read from itComputer program be mounted into as needed storage part 708.
Especially, in accordance with an embodiment of the present disclosure, computer is may be implemented as above with reference to the process of flow chart descriptionSoftware program.For example, embodiment of the disclosure includes a kind of computer program, and which includes being tangibly embodied in machine readableComputer program on medium, the computer program include the program code for the method shown in execution flow chart.SoEmbodiment in, the computer program can be downloaded and installed from network by communications portion 709, and/or from detachableMedium 711 is mounted.
Flow chart and block diagram in accompanying drawing, it is illustrated that according to the system of the various embodiments of the application, method and computer journeyThe architectural framework in the cards of sequence product, function and operation.At this point, each square frame in flow chart or block diagram can generationA part for table one module, program segment or code, a part for the module, program segment or code are used comprising one or moreIn the executable instruction of the logic function for realizing regulation.It should also be noted that in some are as the realization replaced, being marked in square frameThe function of note can also occur with the order different from being marked in accompanying drawing.For example, two square frames for succeedingly representing are actuallyCan perform substantially in parallel, they can also be performed sometimes in the opposite order, this is depending on involved function.To also noteMeaning, the combination of each square frame and block diagram and/or the square frame in flow chart in block diagram and/or flow chart can be with holdingThe special hardware based system of the fixed function of professional etiquette or operation is realizing, or can use specialized hardware and computer instructionCombination realizing.
In being described in the embodiment of the present application, involved unit can be realized by way of software, it is also possible to by hardThe mode of part is realizing.Described unit can also be arranged within a processor, for example, can be described as:A kind of processor bagInclude receiving unit, determining unit, setting unit and initiate unit.Wherein, the title of these units not structure under certain conditionsThe in pairs unit restriction of itself, for example, initiates unit and is also described as that " web page browsing of receive user is asked to long companyConnect server to initiate for being arranged the list of the remote procedure call of the instant message push to client set of type of messageUnit ".
As on the other hand, present invention also provides a kind of nonvolatile computer storage media, the non-volatile calculatingMachine storage medium can be the nonvolatile computer storage media in above-described embodiment included in device;Can also be independentExist, without the nonvolatile computer storage media allocated in terminal.Above-mentioned nonvolatile computer storage media is stored withOne or more program, when said one or multiple programs are performed by an equipment so that the equipment:Receive long connectionThe instant message of server redirection, wherein the instant message is to set up the client that length is connected with the long connection serverThe instant message sent by client in the set of end;Determine the client terminal quantity of the client set;The comparison clientEnd quantity and first threshold, and the instant message is set to by corresponding type of message according to comparative result, wherein, the visitorWhen family end quantity is less than or equal to first threshold, corresponding type of message is reverse drawing pattern, and the client terminal quantity is more than the first thresholdDuring value, corresponding type of message is straight push-model;Initiate for being arranged described in type of message to the long connection serverThe remote procedure call of instant message push to the client set.Or, above-mentioned nonvolatile computer storage media is depositedOne or more program is contained, when said one or multiple programs are performed by an equipment so that the equipment:Receive withThe instant message sent by the client that the long connection server is set up in the client set of long connection;Will be described instantMessage is redirected to message server;Receive the message server to the instant message arrange type of message after, initiateThe instant message push has been set by type of message to the client set remote procedure call;Perform described remoteThe journey invocation of procedure with by the instant message push to the client set;Wherein, the type of message is the message clothesBusiness device is compared with first threshold to the client terminal quantity of the client set and is disappeared to described immediately according to comparative resultBreath arrange, the client terminal quantity be less than first threshold when corresponding type of message be reverse drawing pattern, the client terminal quantityIt is straight push-model more than corresponding type of message during first threshold.
Above description is only the preferred embodiment and the explanation to institute's application technology principle of the application.People in the artMember is it should be appreciated that invention scope involved in the application, however it is not limited to the technology of the particular combination of above-mentioned technical characteristicScheme, while should also cover in the case of without departing from the inventive concept, is carried out by above-mentioned technical characteristic or its equivalent featureCombination in any and other technical schemes for being formed.Such as features described above has similar work(with (but not limited to) disclosed hereinThe technical scheme that the technical characteristic of energy is replaced mutually and formed.