CN105337935A - Method of establishing long connection of client and server and apparatus thereof - Google Patents

Method of establishing long connection of client and server and apparatus thereof Download PDF

Info

Publication number
CN105337935A
CN105337935A CN201410326014.2A CN201410326014A CN105337935A CN 105337935 A CN105337935 A CN 105337935A CN 201410326014 A CN201410326014 A CN 201410326014A CN 105337935 A CN105337935 A CN 105337935A
Authority
CN
China
Prior art keywords
connection
server
client
key
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201410326014.2A
Other languages
Chinese (zh)
Other versions
CN105337935B (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.)
Advanced New Technologies Co 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 CN201410326014.2A priority Critical patent/CN105337935B/en
Publication of CN105337935A publication Critical patent/CN105337935A/en
Priority to HK16107105.9A priority patent/HK1219185A1/en
Application granted granted Critical
Publication of CN105337935B publication Critical patent/CN105337935B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Small-Scale Networks (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention provides a method of establishing long connection of a client and a server and an apparatus thereof. The method comprises the following steps of acquiring a secret key, a connection ID and a connection server address from a secret key server; according to the connection server address, sending a connection request to a connection server, wherein the connection request carries the connection ID so that the connection server acquires a secret key corresponding to the connection ID from a secret key server; carrying out mutual decryption verification with the connection server through the secret key, and after the decryption verification is passed, establishing connection with the connection server; through a preset time period, sending a heartbeat message to the connection server. In the invention, a communication protocol designed autonomously is used; long connection between the client and the server is established; simultaneously, encryption processing is performed on data transmitted by a user and safety is high.

Description

A kind of method and apparatus set up client and be connected with service end length
Technical field
The application relates to communication technical field, particularly relates to a kind of method and apparatus set up client and be connected with service end length.
Background technology
Along with the develop rapidly of Internet technology, user can realize connecting with the service end of application software by the client of application software, carries out information interaction.Such as: Alipay client, Taobao's client etc.
Service end, can also to the various information of client push after connecting with client.But the connection between service end and client is initiated by client usually, if do not connected in advance, service end cannot push information to client.So a kind of client of setting up urgently provides with the long solution be connected of service end.
Summary of the invention
In view of this, the application provides a kind of and sets up the client method and apparatus that be connected long with service end.
Particularly, the application is achieved by the following technical solution:
Set up the client method that be connected long with service end, on the client, described method comprises in application:
Key, connection ID and connection server address is obtained from key server;
According to described connection server address, send connection request to described connection server, carry described connection ID in described connection request, obtain key corresponding to described connection ID for described connection server to described key server;
And mutually decipher verification by described key between described connection server, and connected by rear and described connection server in deciphering verification;
Heartbeat message is sent to described connection server by the time cycle of presetting.
Set up the client method that be connected long with service end, be applied on connection server, described method comprises:
Receive the connection request that client sends, in described connection request, carry the connection ID of client;
Key corresponding to described connection ID is obtained from key server;
And mutually decipher verification by described key between described client, and connected by rear and described client in deciphering verification;
Receive the heartbeat message that client sends, to safeguard the described connection between client.
Set up the client device that be connected long with service end, on the client, described device comprises in application:
First acquiring unit, obtains key, connection ID and connection server address from key server;
Request transmitting unit, according to described connection server address, sends connection request to described connection server, carries described connection ID, obtain key corresponding to described connection ID for described connection server to described key server in described connection request;
First verification unit, and mutually decipher verification by described key between described connection server, and connected by rear and described connection server in deciphering verification;
First heartbeat unit, sends heartbeat message to described connection server by the time cycle of presetting.
Set up the client device that be connected long with service end, be applied on connection server, described device comprises:
Request reception unit, receives the connection request that client sends, carries the connection ID of client in described connection request;
Second acquisition unit, obtains key corresponding to described connection ID from key server;
Second verification unit, and mutually decipher verification by described key between described client, and connected by rear and described client in deciphering verification;
Second heartbeat unit, receives the heartbeat message that client sends, to safeguard the described connection between client.
Described as can be seen from above, the application's client is before communicating with service end, first obtain the information such as key, connection ID and connection server address from key server, then client and connection server are by carrying out deciphering verification mutually to complete handshake procedure, are connected with the long of service end subsequently through heartbeat message maintenance.The application uses the communications protocol of autonomous Design, and can realize being encrypted the data of user's transmission simultaneously, and fail safe is higher.
Accompanying drawing explanation
Fig. 1 is the flow chart setting up the method that client is connected with service end length in the application one embodiment.
Fig. 2 is the flow chart setting up the method that client is connected with service end length in another embodiment of the application.
Fig. 3 is the flow chart setting up the method that client is connected with service end length in another embodiment of the application.
Fig. 4 is the flow chart setting up the method that client is connected with service end length in another embodiment of the application.
Fig. 5 is the message format figure in the application one embodiment.
Fig. 6 is the structural representation of subscriber terminal equipment in the application one embodiment.
Fig. 7 sets up the client apparatus structure schematic diagram that be connected long with service end in the application one embodiment.
Fig. 8 is the structural representation of connection server in the application one embodiment.
Fig. 9 sets up the client apparatus structure schematic diagram that be connected long with service end in another embodiment of the application.
Embodiment
Here will be described exemplary embodiment in detail, its sample table shows in the accompanying drawings.When description below relates to accompanying drawing, unless otherwise indicated, the same numbers in different accompanying drawing represents same or analogous key element.Execution mode described in following exemplary embodiment does not represent all execution modes consistent with the application.On the contrary, they only with as in appended claims describe in detail, the example of apparatus and method that some aspects of the application are consistent.
Only for describing the object of specific embodiment at term used in this application, and not intended to be limiting the application." one ", " described " and " being somebody's turn to do " of the singulative used in the application and appended claims is also intended to comprise most form, unless context clearly represents other implications.It is also understood that term "and/or" used herein refer to and comprise one or more project of listing be associated any or all may combine.
Term first, second, third, etc. may be adopted although should be appreciated that to describe various information in the application, these information should not be limited to these terms.These terms are only used for the information of same type to be distinguished from each other out.Such as, when not departing from the application's scope, the first information also can be called as the second information, and similarly, the second information also can be called as the first information.Depend on linguistic context, word as used in this " if " can be construed as into " ... time " or " when ... time " or " in response to determining ".
For current Problems existing, the application provides a kind of and sets up the client solution that be connected long with service end.The network environment of this solution comprises: client, connection server, key server and service server.Described client is arranged on subscriber terminal equipment usually, and user can visit the service server of software supplier by client.Described connection server connects client and service server, the message communicated between transfer client and service server.Described key server is used for providing the information such as key, connection server address for client.
Please refer to Fig. 1, Fig. 1 is that the client of setting up that the application one embodiment provides grows with service end the method be connected, and the method application on the client, comprises the following steps:
Step 101, obtains key, connection ID and connection server address from key server.
In the present embodiment, described key server is used for providing the information such as key, connection ID, connection server address, key expiration time for client.User is when using client to log in, and client is to the key used from described key server acquisition data communication, and communicate with service server used connection ID and connection server address.Described connection ID is the unique identification of client communication, and the connection ID of different clients is different, and described connection server address can be multiple.
Step 102, according to described connection server address, sends connection request to described connection server, carries described connection ID, obtain key corresponding to described connection ID for described connection server to described key server in described connection request.
Based on the connection server address that step 101 gets, client can be initiated to connect to it in random selecting connection server address, and carry the connection ID that key server provides in a connection request, described connection server, after receiving connection request, obtains corresponding key according to described connection ID to described key server.
Step 103, and mutually decipher verification by described key between described connection server, and connected by rear and described connection server in deciphering verification.
In the present embodiment, based on step 101, client gets key from key server, and based on step 102, connection server also can get described key from key server according to the connection ID of carrying in client's side link request.In this step, client and connection server decipher verification mutually according to the key got separately, if deciphering verification is passed through, connection server can send successful connection message to notify that client's side link is successfully established.
Step 104, sends heartbeat message to described connection server by the time cycle of presetting.
Client, after successfully connecting with connection server, safeguards the validity of connection by periodically sending heartbeat message, so that client receives the message that described connection server pushes.
Described as can be seen from above, the application's client is before communicating with service end, first obtain the information such as key, connection ID and connection server address from key server, then client and connection server are by carrying out deciphering verification mutually to complete handshake procedure, are connected with the long of service end subsequently through heartbeat message maintenance.The application uses the communications protocol of autonomous Design, and can realize being encrypted the data of user's transmission simultaneously, and fail safe is higher.
Please refer to Fig. 2, Fig. 2 is that the client of setting up that the application one embodiment provides grows with service end the method be connected, and the method is applied on connection server, comprises the following steps:
Step 201, receives the connection request that client sends, carries the connection ID of client in described connection request.
Step 202, obtains key corresponding to described connection ID from key server.
In the present embodiment, connection server is after the connection request receiving client transmission, the connection ID that client is carried is obtained from described connection request, then described connection ID is sent to key server, to obtain the key that key server distributes for the client sending described connection request.
Step 203, and mutually decipher verification by described key between described client, and connected by rear and described client in deciphering verification.
In the present embodiment, connection server is based on the key got in step 202, and client deciphers verification mutually, if deciphering verification is passed through, then sends successful connection message to notify that client's side link is successfully established.
Step 204, receive client send heartbeat message, with safeguard with client before described connection.
Described as can be seen from above, the connection server of the application is after receiving the connection request of client, the key being handed down to client is first obtained from key server, then connection server and client are by carrying out deciphering verification mutually to complete handshake procedure, are connected with the long of client subsequently through the heartbeat message maintenance received.The application uses the communications protocol of autonomous Design, and can realize being encrypted the data of user's transmission simultaneously, and fail safe is higher.
Below with in specific implementation process, it is that example is described that client and service end set up the long process be connected.
Please refer to Fig. 3 and Fig. 4, what the application one embodiment provided sets up the client method that be connected long with service end, and the method comprises the following steps:
Step 301, client obtains key, connection ID and connection server address from key server.
In this step; usually the domain name of described key server can be preserved in client; after user uses client logs system; such as: user inputs username and password on client end interface; the information such as the log-on message of user, terminal type and version number, by key server according to the key server domain name access preserved, are sent to described key server by client.
Key server is this client establishment key, key expiration time, connection ID according to above-mentioned information, and preserves the corresponding relation of above-mentioned information and client logs information.Meanwhile, described key server also can gather the operable connection server address of this client current.Wherein, described key is enciphering and deciphering algorithm, such as: DES (DataEncryptionStandard, DEA), AES (AdvancedEncryptionStandard, Advanced Encryption Standard) etc., the application does not limit enciphering and deciphering algorithm.The log-on message of described connection ID and user is corresponding, and be the unique identification that described client uses in communication process, described key server is that different clients creates different connection ID.Described connection server address includes: connection server IP address and port numbers, and described connection server address is generally multiple.The information such as above-mentioned key, key expiration time, connection ID and connection server address are returned to client by described key server.
Certainly, client is with in the process of key server communication, also can the certificate of authentication secret server whether legal effectively and domain name whether mate etc., those skilled in the art can be known according to the implementation procedure in correlation technique, and the application does not repeat them here.
Step 302, client, according to described connection server address, sends connection request to described connection server.
In this step, in the connection server address that client can return at key server, random selecting connection server initiates connection request, and carries connection ID in described connection request.
Step 303, connection server receives described connection request, obtains key corresponding to described connection ID from key server.
In this step, connection server is after the connection request receiving client transmission, therefrom obtain the connection ID that client is carried, then this connection ID is sent to key server, key corresponding for described connection ID is sent to described connection server by key server.So far, client and connection server all obtain described key, and then can be decrypted verification according to described key.
If described connection server obtains key failure corresponding to described connection ID, such as: Network Abnormal causes described connection server not receive described key within the time of presetting, the then connection of described connection server disconnection and client, client re-executes step 301 after the error is detected.
Step 304, connection server sends to client by the first initial data and according to the first enciphered data that described secret key encryption first initial data obtains.
In this step, described connection server is getting key corresponding to client's side link ID, after namely key server is handed down to the key of client, stochastic generation first initial data, then the first initial data described in described secret key encryption is used to obtain the first enciphered data, described first initial data and described first enciphered data are sent to client, verifies for client decrypts.
Step 305, client is the first enciphered data according to the secret key decryption got from key server.
In this step, client judges that whether the data that described first enciphered data of deciphering obtains are consistent with described first initial data, if unanimously, then confirms that the deciphering verification of this side is passed through, goes to step 306.If inconsistent, then the connection of disconnection and described connection server, re-executes step 301.
Step 306, client sends the second initial data and the second enciphered data of obtaining of described second initial data of encryption to described connection server.
In this step, in this side, deciphering verifies by rear client, stochastic generation second initial data, then the second initial data described in its secret key encryption got at key server is used to obtain the second enciphered data, described second initial data and the second enciphered data are sent to described connection server, is decrypted verification for described connection server.
Step 307, described second enciphered data of connection server deciphering.
In this step, described connection server is the second enciphered data according to the secret key decryption got from key server, then judges that data whether with the second initial data that described second enciphered data of deciphering obtains is consistent, if unanimously, then confirm that the deciphering verification of this side is passed through, go to step 308.If inconsistent, the connection of disconnection and client, client re-executes step 301 after mistake being detected.
Step 308, connection server sends successful connection message to described client.
So far, client, after the successful connection message receiving connection server transmission, would have been completed the handshake procedure with described connection server, and success establishes with described connection server and is connected.
Step 309, client sends heartbeat message to described connection server by the time cycle of presetting.
Client is after successfully connecting with connection server, and can safeguard that described connection is not interrupted by sending heartbeat message, the described default time cycle can be arranged by developer.Described connection server receive client send be heartbeat message after, safeguard that the connection of itself and client is not interrupted.If described connection server does not receive the heartbeat message that client sends within the time of presetting, such as, the heartbeat message that client sends all is not received in 2 minutes, the then disconnecting of confirmation and client, send error message to client, so that client re-establishes connection.Certainly, in practical implementations, consider that the factors such as network concussion may cause message delay, also can take retry mechanism, such as: at continuous 3 in 2 minutes, namely all do not receive the heartbeat message that client sends in 6 minutes, then confirm disconnecting.
So far, just establish long connection between client and connection server, based on described long connection, client can be communicated with service server by described connection server, and uses above-mentioned double secret key data to be encrypted in the process of communication.Particularly, client sends to service server by described connection server after being encrypted by data message according to described key, be decrypted by connection server after described data message arrives connection server, and the data message after deciphering is sent to service server.This is because normally transmit data in Intranet between service server and connection server, internet security is relatively high, so can not encrypt, directly transmit expressly.
After the PUSH message of service server platform upon receipt, described PUSH message is sent to connection server, and described connection server is encrypted described PUSH message, is then transmitted to client by described long connection.Wherein, concrete propelling movement process those skilled in the art can with reference to the realization rate in correlation technique, and the application does not limit this.
Please refer to Fig. 5, the message format figure in a kind of embodiment of the application.
Wherein, magic_num is fixing integer, such as 832024031, and be equivalent to the ID of type of message, do not need to process it.
Type field, for representing type of message, comprising: up, descending, shake hands, PUSH message, heartbeat message etc.
Status field is for representing communication type, encryption type, type of coding etc.
Proto_size field is for representing the byte number of structural data.
Checksum field is easy check code.
The data such as App_data field is used for carrying data, contrast PUSH message can be encrypted this field.
Certainly, those skilled in the art also can use other message formats to realize the application, and the application does not limit this.
Described as can be seen from above, the application's client is before communicating with service end, first obtain the information such as key, connection ID and connection server address from key server, then client and connection server are by carrying out deciphering verification mutually to complete handshake procedure, are connected with the long of service end subsequently through heartbeat message maintenance.The application uses the communications protocol of autonomous Design, and can realize being encrypted the data of user's transmission simultaneously, and fail safe is higher.
To set up the long embodiment of the method connected of client and service end corresponding with the application, present invention also provides a kind ofly to set up the embodiment that client and service end grow the device be connected.For software simulating, described device may operate on subscriber terminal equipment, and as the operation carrier of the application's device, described subscriber terminal equipment at least includes CPU, internal memory and nonvolatile memory usually, also may comprise the hardware such as I/O interface.Please refer to Fig. 6 and Fig. 7, the application sets up the client apparatus structure schematic diagram that be connected long with service end, and described device includes: the first acquiring unit, request transmitting unit, the first verification unit, the first heartbeat unit, data transmission unit and data receipt unit.
Wherein, described first acquiring unit, obtains key, connection ID and connection server address from key server.
Described request transmitting element, according to described connection server address, send connection request to described connection server, carry described connection ID in described connection request, obtain key corresponding to described connection ID for described connection server to described key server.
Described first verification unit, and mutually decipher verification by described key between described connection server, and connected by rear and described connection server in deciphering verification;
Described first heartbeat unit, sends heartbeat message to described connection server by the time cycle of presetting.
Further, between described first verification unit and described connection server, mutually decipher verification by described key, and to be connected by rear and described connection server in deciphering verification and comprise:
Receive connection server according to it from the first enciphered data obtained after the key that key server gets is encrypted and the first initial data;
The first enciphered data according to the secret key decryption got from key server;
When deciphering the data that obtain of described first enciphered data and being consistent with described first initial data, confirm that deciphering verification is passed through, and send the second initial data and encrypt the second enciphered data that described second initial data obtains to described connection server;
Receive the successful connection message that described connection server sends after the second enciphered data described in deciphering verification succeeds.
Further, when deciphering the data that obtain of described first enciphered data and being inconsistent with described first initial data, described first acquiring unit is again from key server acquisition key, connection ID and connection server address.
Further, described first acquiring unit obtains key, connection ID and connection server address from key server and comprises: log-on message is sent to described key server; Receive key that described key server returns according to described log-on message, connection ID and connection server address.
Further, described device also comprises:
Data transmission unit, by described connection server sends to service server after being encrypted by data message according to described key.
Data receipt unit, after receiving the enciphered data message of described connection server transmission, is decrypted to obtain initial data according to described key.
Present invention also provides a kind of embodiment setting up the device that client is connected with service end length.For software simulating, described device may operate on connection server, and as the operation carrier of the application's device, described connection server at least includes CPU, internal memory and nonvolatile memory usually, also may comprise the hardware such as I/O interface.Please refer to Fig. 8 and Fig. 9, described device includes: request reception unit, second acquisition unit, the second verification unit, the second heartbeat unit and encryption retransmission unit.
Wherein, described request receiving element, receives the connection request that client sends, carries the connection ID of client in described connection request.
Second acquisition unit, obtains key corresponding to described connection ID from key server.
Second verification unit, and mutually decipher verification by described key between described client, and connected by rear and described client in deciphering verification.
Second heartbeat unit, receives the heartbeat message that client sends, to safeguard the described connection between client.
Further, between described second verification unit and described client, mutually decipher verification by described key, and to be connected by rear and described client in deciphering verification and comprise:
Client is sent by the first initial data and according to the first enciphered data that described secret key encryption first initial data obtains;
The second initial data that reception client sends after the first enciphered data described in deciphering verification succeeds and the second enciphered data;
When the data that described second enciphered data of deciphering obtains are consistent with described second initial data, send successful connection message to described client.
Further, when deciphering the data that obtain of described second enciphered data and being inconsistent with described second initial data, the connection of described second verification unit disconnection and described client.
Further, when not receiving the heartbeat message of client transmission within the time of presetting, described second heartbeat unit confirms the described disconnecting between client.
Further, described device also comprises:
Encryption retransmission unit, is transmitted to described client after sending to the PUSH message of client to encrypt service server by described connection.
In said apparatus, the implementation procedure of the function and efficacy of unit specifically refers to the implementation procedure of corresponding step in said method, does not repeat them here.
For device embodiment, because it corresponds essentially to embodiment of the method, so relevant part illustrates see the part of embodiment of the method.Device embodiment described above is only schematic, the wherein said unit illustrated as separating component or can may not be and physically separates, parts as unit display can be or may not be physical location, namely can be positioned at a place, or also can be distributed in multiple network element.Some or all of module wherein can be selected according to the actual needs to realize the object of the application's scheme.Those of ordinary skill in the art, when not paying creative work, are namely appreciated that and implement.
The foregoing is only the preferred embodiment of the application, not in order to limit the application, within all spirit in the application and principle, any amendment made, equivalent replacements, improvement etc., all should be included within scope that the application protects.

Claims (20)

1. set up the client method that be connected long with service end, on the client, it is characterized in that, described method comprises in application:
Key, connection ID and connection server address is obtained from key server;
According to described connection server address, send connection request to described connection server, carry described connection ID in described connection request, obtain key corresponding to described connection ID for described connection server to described key server;
And mutually decipher verification by described key between described connection server, and connected by rear and described connection server in deciphering verification;
Heartbeat message is sent to described connection server by the time cycle of presetting.
2. method according to claim 1, is characterized in that,
Mutually decipher verification by described key between described and described connection server, and to be connected by rear and described connection server in deciphering verification and comprise:
Receive connection server according to it from the first enciphered data obtained after the key that key server gets is encrypted and the first initial data;
The first enciphered data according to the secret key decryption got from key server;
When deciphering the data that obtain of described first enciphered data and being consistent with described first initial data, confirm that deciphering verification is passed through, and send the second initial data and encrypt the second enciphered data that described second initial data obtains to described connection server;
Receive the successful connection message that described connection server sends after the second enciphered data described in deciphering verification succeeds.
3. method according to claim 2, is characterized in that,
When deciphering the data that obtain of described first enciphered data and being inconsistent with described first initial data, again from key server acquisition key, connection ID and connection server address.
4. method according to claim 1, is characterized in that,
Describedly obtain key from key server, connection ID and connection server address comprise:
Log-on message is sent to described key server;
Receive key that described key server returns according to described log-on message, connection ID and connection server address.
5. method according to claim 1, is characterized in that, described method also comprises:
Service server is sent to by described connection server after being encrypted by data message according to described key;
After receiving the enciphered data message of described connection server transmission, be decrypted to obtain initial data according to described key.
6. set up the client method that be connected long with service end, be applied on connection server, it is characterized in that, described method comprises:
Receive the connection request that client sends, in described connection request, carry the connection ID of client;
Key corresponding to described connection ID is obtained from key server;
And mutually decipher verification by described key between described client, and connected by rear and described client in deciphering verification;
Receive the heartbeat message that client sends, to safeguard the described connection between client.
7. method according to claim 6, is characterized in that,
Mutually verified by described key between described and described client, and to be connected by rear and described client in verification and comprise:
Client is sent by the first initial data and according to the first enciphered data that described secret key encryption first initial data obtains;
The second initial data that reception client sends after the first enciphered data described in deciphering verification succeeds and the second enciphered data;
When the data that described second enciphered data of deciphering obtains are consistent with described second initial data, send successful connection message to described client.
8. method according to claim 7, is characterized in that, described method also comprises:
When deciphering the data that obtain of described second enciphered data and being inconsistent with described second initial data, the connection of disconnection and described client.
9. method according to claim 6, is characterized in that, described method also comprises:
When not receiving the heartbeat message of client transmission within the time of presetting, confirm the described disconnecting between client.
10. method according to claim 6, is characterized in that, described method also comprises:
Described client is transmitted to after sending to the PUSH message of client to encrypt service server by described connection.
Set up the client device that be connected long with service end for 11. 1 kinds, on the client, it is characterized in that, described device comprises in application:
First acquiring unit, obtains key, connection ID and connection server address from key server;
Request transmitting unit, according to described connection server address, sends connection request to described connection server, carries described connection ID, obtain key corresponding to described connection ID for described connection server to described key server in described connection request;
First verification unit, and mutually decipher verification by described key between described connection server, and connected by rear and described connection server in deciphering verification;
First heartbeat unit, sends heartbeat message to described connection server by the time cycle of presetting.
12. devices according to claim 11, is characterized in that,
Mutually decipher verification by described key between described first verification unit and described connection server, and to be connected by rear and described connection server in deciphering verification and comprise:
Receive connection server according to it from the first enciphered data obtained after the key that key server gets is encrypted and the first initial data;
The first enciphered data according to the secret key decryption got from key server;
When deciphering the data that obtain of described first enciphered data and being consistent with described first initial data, confirm that deciphering verification is passed through, and send the second initial data and encrypt the second enciphered data that described second initial data obtains to described connection server;
Receive the successful connection message that described connection server sends after the second enciphered data described in deciphering verification succeeds.
13. devices according to claim 12, is characterized in that,
When deciphering the data that obtain of described first enciphered data and being inconsistent with described first initial data, described first acquiring unit is again from key server acquisition key, connection ID and connection server address.
14. devices according to claim 11, is characterized in that,
Described first acquiring unit obtains key, connection ID and connection server address from key server and comprises: log-on message is sent to described key server; Receive key that described key server returns according to described log-on message, connection ID and connection server address.
15. devices according to claim 11, is characterized in that, described device also comprises:
Data transmission unit, by described connection server sends to service server after being encrypted by data message according to described key;
Data receipt unit, after receiving the enciphered data message of described connection server transmission, is decrypted to obtain initial data according to described key.
Set up the client device that be connected long with service end for 16. 1 kinds, be applied on connection server, it is characterized in that, described device comprises:
Request reception unit, receives the connection request that client sends, carries the connection ID of client in described connection request;
Second acquisition unit, obtains key corresponding to described connection ID from key server;
Second verification unit, and mutually decipher verification by described key between described client, and connected by rear and described client in deciphering verification;
Second heartbeat unit, receives the heartbeat message that client sends, to safeguard the described connection between client.
17. devices according to claim 16, is characterized in that,
Mutually decipher verification by described key between described second verification unit and described client, and to be connected by rear and described client in deciphering verification and comprise:
Client is sent by the first initial data and according to the first enciphered data that described secret key encryption first initial data obtains;
The second initial data that reception client sends after the first enciphered data described in deciphering verification succeeds and the second enciphered data;
When the data that described second enciphered data of deciphering obtains are consistent with described second initial data, send successful connection message to described client.
18. devices according to claim 17, is characterized in that,
When deciphering the data that obtain of described second enciphered data and being inconsistent with described second initial data, the connection of described second verification unit disconnection and described client.
19. devices according to claim 16, is characterized in that,
When not receiving the heartbeat message of client transmission within the time of presetting, described second heartbeat unit confirms the described disconnecting between client.
20. devices according to claim 16, is characterized in that, described device also comprises:
Encryption retransmission unit, is transmitted to described client after sending to the PUSH message of client to encrypt service server by described connection.
CN201410326014.2A 2014-07-09 2014-07-09 A kind of method and apparatus for establishing client and the long connection of server-side Active CN105337935B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201410326014.2A CN105337935B (en) 2014-07-09 2014-07-09 A kind of method and apparatus for establishing client and the long connection of server-side
HK16107105.9A HK1219185A1 (en) 2014-07-09 2016-06-21 Method and device for establishing long connection between client and server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410326014.2A CN105337935B (en) 2014-07-09 2014-07-09 A kind of method and apparatus for establishing client and the long connection of server-side

Publications (2)

Publication Number Publication Date
CN105337935A true CN105337935A (en) 2016-02-17
CN105337935B CN105337935B (en) 2018-12-21

Family

ID=55288223

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410326014.2A Active CN105337935B (en) 2014-07-09 2014-07-09 A kind of method and apparatus for establishing client and the long connection of server-side

Country Status (2)

Country Link
CN (1) CN105337935B (en)
HK (1) HK1219185A1 (en)

Cited By (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106358194A (en) * 2016-10-28 2017-01-25 努比亚技术有限公司 Connection device and connection method of mobile terminal and server
CN106452689A (en) * 2016-11-28 2017-02-22 畅捷通信息技术股份有限公司 Data transmission apparatus and method of client and data transmission apparatus and method of server
CN106603542A (en) * 2016-12-22 2017-04-26 北京雷石天地电子技术有限公司 Cloud end server and offline place server communication method and device
CN108418799A (en) * 2018-02-01 2018-08-17 北京云知声信息技术有限公司 Long establishment of connection method and system
CN108737377A (en) * 2018-04-17 2018-11-02 深圳市网心科技有限公司 Data guard method, server and computer readable storage medium
CN108881105A (en) * 2017-05-08 2018-11-23 中车株洲电力机车研究所有限公司 A kind of method and system of connection setup
CN109274716A (en) * 2018-08-21 2019-01-25 中国平安人寿保险股份有限公司 Method, apparatus, computer equipment and the storage medium of file process
CN109327527A (en) * 2018-10-30 2019-02-12 北京摩拜科技有限公司 Control method for vehicle, server, client, vehicle and Vehicular system
CN110213247A (en) * 2019-05-16 2019-09-06 福建天泉教育科技有限公司 A kind of method and system improving pushed information safety
CN111405028A (en) * 2020-03-12 2020-07-10 中国建设银行股份有限公司 Information processing method, information processing apparatus, server, electronic device, and medium
CN111416807A (en) * 2020-03-13 2020-07-14 苏州科达科技股份有限公司 Data acquisition method, device and storage medium
CN111866770A (en) * 2020-07-21 2020-10-30 上海聚均科技有限公司 Capital monitoring method based on short message
CN112911021A (en) * 2021-03-23 2021-06-04 厦门四信通信科技有限公司 Method, device and equipment for actively connecting terminal
CN115225715A (en) * 2022-06-30 2022-10-21 深圳市云洲创新科技有限公司 Data interaction method and data interaction system
CN115714805A (en) * 2022-11-18 2023-02-24 乾三(北京)科技有限公司 Cross-platform communication connection method and system and electronic equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101090513A (en) * 2006-06-13 2007-12-19 华为技术有限公司 Method for getting service key
CN103139303A (en) * 2013-02-07 2013-06-05 网易(杭州)网络有限公司 Method, device and system used for maintaining connected heartbeat
CN103634266A (en) * 2012-08-21 2014-03-12 上海凌攀信息科技有限公司 A bidirectional authentication method for a server and a terminal
CN103874035A (en) * 2012-12-13 2014-06-18 中国移动通信集团公司 Mobile terminal message pushing method and equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101090513A (en) * 2006-06-13 2007-12-19 华为技术有限公司 Method for getting service key
CN103634266A (en) * 2012-08-21 2014-03-12 上海凌攀信息科技有限公司 A bidirectional authentication method for a server and a terminal
CN103874035A (en) * 2012-12-13 2014-06-18 中国移动通信集团公司 Mobile terminal message pushing method and equipment
CN103139303A (en) * 2013-02-07 2013-06-05 网易(杭州)网络有限公司 Method, device and system used for maintaining connected heartbeat

Cited By (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106358194B (en) * 2016-10-28 2020-03-31 努比亚技术有限公司 Device and method for connecting mobile terminal and server
CN106358194A (en) * 2016-10-28 2017-01-25 努比亚技术有限公司 Connection device and connection method of mobile terminal and server
CN106452689A (en) * 2016-11-28 2017-02-22 畅捷通信息技术股份有限公司 Data transmission apparatus and method of client and data transmission apparatus and method of server
CN106603542A (en) * 2016-12-22 2017-04-26 北京雷石天地电子技术有限公司 Cloud end server and offline place server communication method and device
CN108881105A (en) * 2017-05-08 2018-11-23 中车株洲电力机车研究所有限公司 A kind of method and system of connection setup
CN108418799A (en) * 2018-02-01 2018-08-17 北京云知声信息技术有限公司 Long establishment of connection method and system
CN108737377A (en) * 2018-04-17 2018-11-02 深圳市网心科技有限公司 Data guard method, server and computer readable storage medium
CN109274716A (en) * 2018-08-21 2019-01-25 中国平安人寿保险股份有限公司 Method, apparatus, computer equipment and the storage medium of file process
CN109274716B (en) * 2018-08-21 2023-02-07 中国平安人寿保险股份有限公司 File processing method and device, computer equipment and storage medium
CN109327527A (en) * 2018-10-30 2019-02-12 北京摩拜科技有限公司 Control method for vehicle, server, client, vehicle and Vehicular system
CN110213247B (en) * 2019-05-16 2021-10-01 福建天泉教育科技有限公司 Method and system for improving safety of pushed information
CN110213247A (en) * 2019-05-16 2019-09-06 福建天泉教育科技有限公司 A kind of method and system improving pushed information safety
CN111405028A (en) * 2020-03-12 2020-07-10 中国建设银行股份有限公司 Information processing method, information processing apparatus, server, electronic device, and medium
CN111405028B (en) * 2020-03-12 2022-05-27 中国建设银行股份有限公司 Information processing method, device, server, electronic device and medium
CN111416807A (en) * 2020-03-13 2020-07-14 苏州科达科技股份有限公司 Data acquisition method, device and storage medium
CN111866770A (en) * 2020-07-21 2020-10-30 上海聚均科技有限公司 Capital monitoring method based on short message
CN112911021A (en) * 2021-03-23 2021-06-04 厦门四信通信科技有限公司 Method, device and equipment for actively connecting terminal
CN115225715A (en) * 2022-06-30 2022-10-21 深圳市云洲创新科技有限公司 Data interaction method and data interaction system
CN115225715B (en) * 2022-06-30 2024-01-26 深圳市云洲创新科技有限公司 Data interaction method and data interaction system
CN115714805A (en) * 2022-11-18 2023-02-24 乾三(北京)科技有限公司 Cross-platform communication connection method and system and electronic equipment

Also Published As

Publication number Publication date
HK1219185A1 (en) 2017-03-24
CN105337935B (en) 2018-12-21

Similar Documents

Publication Publication Date Title
CN105337935A (en) Method of establishing long connection of client and server and apparatus thereof
US8370296B2 (en) Method for transmitting SyncML synchronization data
US10084760B2 (en) Secure messages for internet of things devices
CN100581097C (en) System and method for data transmission between two computers
US8214649B2 (en) System and method for secure communications between at least one user device and a network entity
CN103828414B (en) Security gateway communicates
CN107659406B (en) Resource operation method and device
US8639936B2 (en) Methods and entities using IPSec ESP to support security functionality for UDP-based traffic
CN109845214B (en) Method, device and system for transmitting data
EP3602997B1 (en) Mutual authentication system
TWI636373B (en) Method and device for authorizing between devices
TWI581599B (en) Key generation system, data signature and encryption system and method
CN103428221A (en) Safety logging method, system and device of mobile application
CN107181770A (en) Method of data synchronization and system
CN105119894A (en) Communication system and communication method based on hardware safety module
GB2581096A (en) Altering cipher and key within an established session
CN109257387A (en) Method and apparatus for disconnection reconnecting
CN106161224B (en) Method for interchanging data, device and equipment
US10015208B2 (en) Single proxies in secure communication using service function chaining
CN111885091B (en) Secure communication method, device, equipment and storage medium
KR102121399B1 (en) Local information acquisition method, apparatus and system
CN108337083B (en) Method and device for generating secret key in automatic test process
CN101483867A (en) User identity verification method, related device and system in WAP service
KR100925636B1 (en) The networking method between non-pc device and server for providing the application services
CN103973699A (en) Data encryption and decryption methods and devices

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: 1219185

Country of ref document: HK

GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20191216

Address after: P.O. Box 31119, grand exhibition hall, hibiscus street, 802 West Bay Road, Grand Cayman, British Cayman Islands

Patentee after: Innovative advanced technology Co., Ltd

Address before: A four-storey 847 mailbox in Grand Cayman Capital Building, British Cayman Islands

Patentee before: Alibaba Group Holding Co., Ltd.