WO2016165477A1 - Login method, terminal, session establishment method, and server - Google Patents
Login method, terminal, session establishment method, and server Download PDFInfo
- Publication number
- WO2016165477A1 WO2016165477A1 PCT/CN2016/074156 CN2016074156W WO2016165477A1 WO 2016165477 A1 WO2016165477 A1 WO 2016165477A1 CN 2016074156 W CN2016074156 W CN 2016074156W WO 2016165477 A1 WO2016165477 A1 WO 2016165477A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- login
- parameter
- server
- session
- client
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 77
- 238000004891 communication Methods 0.000 claims abstract description 37
- 230000008569 process Effects 0.000 claims description 46
- 238000010295 mobile communication Methods 0.000 description 5
- 230000006835 compression Effects 0.000 description 4
- 238000007906 compression Methods 0.000 description 4
- 230000007246 mechanism Effects 0.000 description 4
- 230000006870 function Effects 0.000 description 3
- 238000010586 diagram Methods 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 230000008859 change Effects 0.000 description 1
- 238000004590 computer program Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 230000000717 retained effect Effects 0.000 description 1
- 239000002699 waste material Substances 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L51/00—User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
- H04L51/04—Real-time or near real-time messaging, e.g. instant messaging [IM]
- H04L51/043—Real-time or near real-time messaging, e.g. instant messaging [IM] using or handling presence information
Definitions
- This document relates to the field of communications, and in particular to a method, a terminal, a session establishment method and a server for implementing login based on the XMPP protocol.
- XMPP Extensible Messaging and Presence Protocol
- XML eXtensible Markup Language
- each session establishment includes a capability negotiation, an authentication authentication, a session establishment process, and the like, and includes multiple sets of interaction messages involving capability negotiation, authentication authentication, and session establishment.
- frequent online and offline resulting in frequent execution of a corresponding set of login processes.
- the process complexity of the login/session establishment process can be further simplified, the traffic consumption is reduced, and the processing pressure of the server is reduced accordingly.
- a method, a terminal and a server for establishing a session based on the XMPP protocol are disclosed.
- This document discloses a method of logging in, including:
- the saved login parameters are used to establish a session and the login is completed.
- the login fails when not logging in for the first time; re-login, negotiate with the server to obtain a new login parameter, and save as the login parameter.
- the login parameter includes: a server capability set parameter and/or an authentication parameter.
- the login parameter further includes: a login attribute, where the login attribute indicates that the login parameter is directly used to log in when not logging in for the first time.
- the login parameter further includes: a login parameter valid time.
- the invention also discloses a terminal based on the extensible communication and presentation protocol XMPP, comprising: a communication unit, a login parameter negotiation unit and a session establishment unit, wherein
- a communication unit configured to communicate with the server based on the extensible communication and presentation protocol XMPP;
- the login parameter negotiation unit is configured to log in to the server, and save the login parameters obtained by negotiation with the server;
- the session establishing unit is configured to establish a session with the server directly by using the saved login parameter when the first login is not performed, and complete the login.
- the server sets a login parameter valid time; after the time of the login parameter is exceeded, the session establishment unit fails to establish a session with the server when the first login is not performed;
- the login parameter negotiation unit is further configured to be established in the session establishing unit and the server After the session fails, log in again, negotiate with the server to obtain a new login parameter, and save it as the login parameter.
- the login parameter includes: the server capability set parameter and/or an authentication parameter.
- the login parameter further includes: a login attribute, where the login attribute indicates that the session is established by using the saved login parameter directly when not logging in for the first time.
- the login parameter further includes: a login parameter valid time.
- the session establishing unit is further configured to determine, according to the valid time of the login parameter, that the login parameter valid time is exceeded, and if not, notify the login parameter negotiation unit to re-execute the first login; If not, the session is established by using the saved login parameter to establish a session with the server, and the login is completed.
- the login parameter negotiation unit is further configured to log in to the server again, and negotiate a new login with the server. Parameters and saved as the login parameters.
- the session establishing unit is further configured to determine, according to the login attribute, whether to establish a session with the server directly by using the saved login parameter when the first login is not performed, and if yes, directly adopting the saved
- the login parameter establishes a session with the server to complete the login; if not, the login parameter negotiation unit is notified to re-execute the first login; accordingly, the login parameter negotiation unit is further configured to re-login to the server and negotiate with the server. Obtain new login parameters and save as the login parameters.
- This question also discloses a method for session establishment, including:
- the client negotiates with the client to determine the login parameter, establishes a session, and instructs the client to save the login parameter.
- the session is established with the client by using the login parameter carried in the non-first login request.
- the login parameter includes: a server capability set parameter and/or an authentication parameter.
- the login parameter further includes: a login attribute, where the login attribute indicates that the client directly uses the saved login parameter to establish a session when not logging in for the first time.
- the login parameter further includes: a login parameter valid time.
- the invention also discloses a server based on the extensible communication and presentation protocol XMPP, which comprises: a communication unit, a first login unit and a quick login unit; wherein
- a communication unit configured to communicate with the client based on the extensible communication and presentation protocol XMPP; receiving a client login request to determine whether it is a first login request;
- the first login unit is configured to: when receiving the first login request, negotiate with the client to determine a login parameter, establish a session; and instruct the client to save the login parameter;
- the quick login unit is configured to establish a session with the client by using the login parameter carried in the non-first login request when receiving the non-first login request.
- the quick login unit is further configured to set a login parameter valid time
- the quick login unit is further configured to return a session establishment failure instruction when the client login time exceeds the valid time of the login parameter, and when the non-first login request is received, instruct the client to perform the first login process.
- the login parameter includes: the server capability set parameter and/or an authentication parameter.
- the login parameter further includes: a login attribute, where the login attribute indicates that the client establishes a session with the server by using the saved login parameter directly when not logging in for the first time.
- the login parameter further includes: a login parameter valid time.
- the client does not need to follow the specifications of the existing XMPP protocol to perform a complete login process, and directly establishes the login parameters negotiated in the historical login process saved by the client. Session, complete login.
- the non-first-time login process of the XMPP solution which is aimed at the frequent and offline business of the XMPP client in the mobile communication field, greatly reduces the consumption of network traffic and reduces the pressure on the server.
- FIG. 1 is a prior art XMPP client login process
- FIG. 2 is a flowchart of a method for logging in to a server according to Embodiment 1 of the present invention
- FIG. 3 is a message flow chart of a login server provided by Embodiments 1 and 3 of the present invention.
- FIG. 4 is a structural diagram of a terminal according to Embodiment 2 of the present invention.
- FIG. 5 is a flowchart of a method for establishing a session according to Embodiment 3 of the present invention.
- FIG. 6 is a structural diagram of a server according to Embodiment 4 of the present invention.
- FIG. 1 the process of the server login by the XMPP client is as shown in FIG. 1 , including:
- the client opens the stream and initiates a server capability query; the server returns server capability information; (indicating which authentication authentication the client needs to perform)
- the client initiates authentication and authentication according to the server indication; the server returns the authentication result;
- the client initiates a server capability query; the server returns server capability information; (indicating which binding the client can perform)
- the client initiates a resource binding request; the server returns a binding request result;
- the client establishes a session with the server and completes the login.
- this paper discloses a method, terminal, and session establishment method for logging in to the server. server.
- Embodiment 1 is a diagrammatic representation of Embodiment 1:
- a login method as shown in Figure 2, the client communicates with the server based on the scalable communication and presentation protocol XMPP; the specific process is as follows:
- Step 201 Determine whether it is the first time login; if yes, go to step 202; if not, go to step 203;
- Step 202 Perform a normal login process in the prior art solution, and after login, save the login parameters determined by the server in the normal login process.
- Step 203 The ordinary login process in the prior art solution is not executed, and the saved login parameter is directly used to establish a session, and the login is completed.
- step 203 includes:
- the server presets the login parameter valid time
- the session is established by using the saved login parameters.
- the session fails to be established.
- the normal login process is re-executed, the new login parameters are obtained, and the history is saved. Login parameters.
- the login parameters in the above steps include: a server capability set parameter and/or an authentication parameter;
- the server capability set parameter indicates a capability requirement for the XMPP session establishment supported by the server, and the capability requirement includes one or more of the following:
- TLS Traffic Layer Security
- SASL Simple Authentication Security Layer
- server-supported SASL authentication mechanism whether to support zlib compression and terminal binding policy
- the authentication parameter indicates the authentication parameters used when successfully logging in, including one or more of the following:
- Selected TLS policy selected SASL authentication mechanism, whether to use zlib compression, selected terminal binding policy, authentication username and authentication user password;
- the specific server capability set parameters and/or the authentication parameters included in the foregoing login parameters are not limited to the contents exemplified in the embodiment, and include the login parameters negotiated and used in the normal login process in the prior art solution.
- the login parameter in the foregoing step further includes: a login attribute, indicating that the client directly logs in using the saved login parameter when not logging in for the first time, and when the server supports directly using the saved login parameter to log in, that is, the server When the fast login process is supported, the client can directly log in using the saved login parameters.
- the fast login process here does not perform the normal login process in the prior art solution, and does not perform capability negotiation between the client and the server.
- the client uses the locally saved login parameters to initiate a non-first login request.
- the server establishes a session with the client by using the login parameters carried in the non-first login request sent by the client to complete the login.
- step 201 can be replaced by:
- step 202 Determining whether it is the first login; if it is the first login, executing step 202; if it is not the first login, further determining whether the login attribute indicates that the saved login parameter is used to establish the session directly when not logging in for the first time, if the indication can be non-first time
- step 203 is executed. The situation indicates that the server supports directly using the saved login parameter to log in; if the indication is not, the saved login parameter may be directly used when not logging in for the first time.
- step 202 is performed, which indicates that the server does not support supporting login with the saved login parameters.
- the login parameter also includes a valid time of the login parameter, indicating a valid time for allowing the client to log in using the saved historical login parameter.
- the server adjusts the valid time of the login parameter, so that the adjusted login parameter valid time is less than the current time.
- the session established by using the saved login parameter directly fails to be established;
- the first login process, negotiated to get new The login parameters are saved and overwritten with the history saved login parameters.
- step 203 further includes:
- the client searches for the locally saved login parameters. If found, the session is established by using the saved login parameters to complete the login. If not found, the normal login process is re-executed, the new login parameters are obtained, and the history is saved. Login parameter;
- the client determines whether the current login time exceeds the valid time according to the valid time of the login parameter included in the locally saved login parameter; if not, that is, within the valid time range, the session is directly established by using the saved login parameter. Complete the login; if it is exceeded, re-execute the normal login process, negotiate to obtain new login parameters, and save, overwriting the historically saved login parameters.
- step 202 is implemented, which may be:
- the server extension returns the FEATURE field in the message, and adds the login attribute field, indicating that the server supports direct login using the saved login parameters.
- step 202 is implemented, which may be:
- the server extension returns the FEATURE field in the message, and increases the effective time of the login parameter, indicating the effective time of the login parameter set by the current server;
- the implementation step 203 may be:
- Step 301 The client obtains the saved login parameter locally, and the required parameters for the login authentication Included in the authentication message (AUTH), sent to the server;
- Step 302 The server receives the authentication message, performs authentication, and returns a success message after the authentication succeeds;
- Step 303 The client obtains the saved login parameter locally, and the parameters required for performing the client binding are included in the binding message (IQ (SET BIND)), and are sent to the server;
- Step 304 The server receives the binding message, performs binding, returns the binding success, establishes a session, and completes the login.
- Embodiment 2 is a diagrammatic representation of Embodiment 1:
- a terminal based on scalable communication and presentation protocol XMPP comprising: a communication unit, a login parameter negotiation unit and a session establishment unit;
- a communication unit configured to communicate with the server based on the extensible communication and presentation protocol XMPP;
- the login parameter negotiation unit is configured to save the login parameter obtained by negotiation with the server when logging in for the first time;
- the session establishing unit is configured to establish a session with the server directly by using the saved login parameter when the first login is not performed, and complete the login.
- the server sets the login parameter valid time; after the valid time of the set login parameter is exceeded, the session establishment unit fails to establish a session with the server;
- the login parameter includes: the server capability set parameter and/or the authentication parameter;
- the login parameter further includes: a login attribute; the login attribute indicates that the client directly establishes the session by using the saved login parameter when not logging in for the first time;
- the login parameter further includes: a login parameter valid time.
- the login parameter negotiation unit is further configured to: after the session establishment unit fails to establish a session with the server, log in again, negotiate with the server to obtain a new login parameter, and save the login parameter as the login parameter.
- the session establishing unit is further configured to determine, according to the valid time of the login parameter, that the login parameter valid time is exceeded, and if not, notify the login parameter negotiation unit to perform the first login again; if not If yes, the session is established with the saved login parameter to complete the login; correspondingly, the login parameter negotiation unit is further configured to log in to the server again, and negotiate with the server to obtain a new login parameter. And saved as the login parameter.
- the session establishing unit is further configured to, according to the login attribute, determine whether to directly establish a session with the server by using the saved login parameter, and if yes, directly establish a session with the server by using the saved login parameter. And completing the login; if not, notifying the login parameter negotiation unit to re-execute the first login; correspondingly, the login parameter negotiation unit is further configured to re-login to the server, and negotiate with the server to obtain a new login parameter, And saved as the login parameter.
- FIG. 1 A method of session establishment, as shown in FIG. 1
- the server communicates with the client based on the Extensible Communication and Presentation Protocol XMPP, including:
- Step 501 Receive a login request
- Step 502 Determine whether it is a first login request; when the login request is a first login request, step 503 is performed, when the login request is a non-first login request, step 504 is performed;
- Step 503 Perform a normal login process to negotiate with the client to determine a login parameter, establish a session, and instruct the client to save the login parameter.
- Step 504 Establish a session with the client by using the login parameter carried in the non-first login request.
- the server sets a login parameter valid time
- the login parameters include: a server capability set parameter and/or an authentication parameter.
- the server capability set parameter indicates the capability requirement of the service to support XMPP session establishment, which requires one or more of the following:
- TLS Traffic Layer Security
- SASL Simple Authentication Security Layer
- server-supported SASL authentication mechanism whether to support zlib compression or terminal binding policy
- the authentication parameter indicates the authentication parameters used when successfully logging in, including one or more of the following:
- Selected TLS policy selected SASL authentication mechanism, whether to use zlib compression, selected terminal binding policy, authentication user name or authentication user password;
- the specific server capability set parameters and/or the authentication parameters included in the foregoing login parameters are not limited to the contents exemplified in the embodiment, and include the login parameters negotiated and used in the normal login process in the prior art solution.
- the login parameter in the foregoing step in the embodiment further includes: a login attribute, indicating that the client directly uses the saved login parameter to request to establish a session when not logging in for the first time, and the server supports directly adopting the saved login parameter.
- Logging in that is, when the server supports the fast login process, the client is instructed to establish a session by using the saved login parameter when the first login is not performed; the fast login process here does not perform the normal login process in the prior art solution. If the capability negotiation between the client and the server is not performed, the login parameter carried in the non-first login request sent by the client is used to establish a session with the client to complete the login.
- the existing message content is extended, which may be:
- the server extends the FEATURE field of the return message in the prior art scheme, and adds a login attribute field, indicating that the server supports direct login using the saved login parameter.
- the login parameter further includes a valid time of the login parameter, indicating a valid time for the server to allow the client to log in using the saved historical login parameter;
- the existing message content is extended, which can be:
- the server extends the FEATURE field of the returned message in the prior art scheme, and adds the login parameter.
- the number of valid times indicates the effective time of the login parameters set by the current server.
- the method for extending the return message in the prior art solution is not specifically limited in the embodiment of the present invention, and any server in the normal login process is selected to return the message for extension, and the client can learn relevant after the login is successful.
- the purpose of the login parameter is not specifically limited in the embodiment of the present invention, and any server in the normal login process is selected to return the message for extension, and the client can learn relevant after the login is successful. The purpose of the login parameter.
- the effective time of the login parameter is adjusted, so that the adjusted login parameter valid time is less than the current time.
- the session fails to be established; the client is instructed to re-execute.
- the first login process negotiated to obtain new login parameters, and save, overwriting historically saved login parameters.
- the received non-first login request execution process combined with the specific message flow, as shown in FIG. 3, may be:
- Step 301 Receive an extended authentication message (AUTH) sent by the client, where the parameter required for login authentication is included;
- AUTH extended authentication message
- Step 302 Perform authentication, and return a success message after the authentication succeeds
- Step 303 Receive an extended binding message (IQ (SET BIND)) sent by the client, where the parameters required to perform client binding are retained;
- Step 304 Perform binding, return binding success, instruct the client to save the current login parameter; establish a session.
- Embodiment 4 is a diagrammatic representation of Embodiment 4:
- a server based on scalable communication and presentation protocol XMPP as shown in FIG. 5, comprising a communication unit, a first login unit, and a fast login unit;
- a communication unit configured to communicate with the client based on the extensible communication and presentation protocol XMPP; receiving a client login request to determine whether it is a first login request;
- the first login unit is configured to: when receiving the first login request, negotiate with the client to determine a login parameter, establish a session; and instruct the client to save the login parameter;
- the quick login unit is configured to establish a session with the client by using the login parameter carried in the non-first login request when receiving the non-first login request.
- the fast login unit is further configured to set a login parameter valid time; after the client login time exceeds the valid time of the login parameter, when the non-first login request is received, returning a session establishment failure instruction, indicating the client Perform the first login process.
- the login parameter includes: the server capability set parameter and/or an authentication parameter;
- the method further includes: a login attribute, where the login attribute indicates that the client directly establishes a session with the server by using the saved login parameter when not logging in for the first time;
- the message returned by the extension server to the client may be:
- the server extends the FEATURE field of the return message in the prior art scheme, and adds a login attribute field, indicating that the server supports direct login using the saved login parameter.
- the login parameter further includes a valid time of the login parameter, indicating a valid time for the server to allow the client to log in using the saved historical login parameter;
- the message returned by the extension server to the client may be:
- the server extends the FEATURE field of the return message in the prior art scheme, and increases the effective time of the login parameter, indicating the effective time of the login parameter set by the current server.
- the server does not specifically limit, and any server in the normal login process is selected to return the message for expansion, and the client can obtain the relevant login after the login is successful.
- the purpose of the parameter is not specifically limit, and any server in the normal login process is selected to return the message for expansion, and the client can obtain the relevant login after the login is successful.
- the server related capability When the server related capability is adjusted, adjust the effective time of the login parameter set by the server, so that the adjusted login parameter valid time is less than the current time. At this time, when the client directly establishes the session by using the saved login parameter, the session establishment fails.
- the server instructs the client to re-execute the first login process, negotiate to obtain new login parameters, and save, overwriting the historically saved login parameters.
- the login parameter is saved when the first login is performed, and the saved login parameter is directly used when the first login is not performed.
- the login parameter negotiation is not required, the login process of the XMPP terminal is simplified, and the fast login is implemented. For the current situation of XMPP clients frequently going online and offline in the mobile communication field, the consumption of network traffic is greatly reduced, and the pressure on the server is alleviated.
- all or part of the steps of the above embodiments may also be implemented by using an integrated circuit. These steps may be separately fabricated into individual integrated circuit modules, or multiple modules or steps may be fabricated into a single integrated circuit module. achieve. Thus, embodiments of the invention are not limited to any specific combination of hardware and software.
- the devices/function modules/functional units in the above embodiments may be implemented by a general-purpose computing device, which may be centralized on a single computing device or distributed over a network of multiple computing devices.
- each device/function module/functional unit in the above embodiment When each device/function module/functional unit in the above embodiment is implemented in the form of a software function module and sold or used as a stand-alone product, it can be stored in a computer readable storage medium.
- the above mentioned computer readable storage medium may be a read only memory, a magnetic disk or an optical disk or the like.
- the solution provided by the embodiment of the present invention saves the login parameter when logging in for the first time, and directly uses the saved login parameter when not logging in for the first time, and does not need to perform login parameter negotiation, which simplifies the login process of the XMPP terminal and implements fast login. For the current situation of XMPP clients frequently going online and offline in the mobile communication field, the consumption of network traffic is greatly reduced, and the pressure on the server is alleviated.
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer And Data Communications (AREA)
Abstract
Description
本文涉及通信领域,尤其涉及一种基于XMPP协议实现登录的方法、终端、会话建立的方法和服务器。This document relates to the field of communications, and in particular to a method, a terminal, a session establishment method and a server for implementing login based on the XMPP protocol.
XMPP(Extensible Messaging and Presence Protocol,可扩展通讯和表示协议)是一种以XML(eXtensible Markup Language,扩展标记语言)为基础的开放式即时通讯协议,可用于服务类实时通讯、表示和需求响应服务中的XML数据元流式传输,凭借其巨大的灵活性和开放性在即时通讯市场上占有了很大的份额。XMPP (Extensible Messaging and Presence Protocol) is an open instant messaging protocol based on XML (eXtensible Markup Language), which can be used for service real-time communication, presentation and demand response services. The streaming of XML data elements in the market, with its great flexibility and openness, has a large share in the instant messaging market.
但是,XMPP协议在移动领域一直被人所诟病,其中一个重要原因是流量消耗较大的问题,而登录流程在流量消耗中占较大比重,因为在移动环境下,用户上下线频繁,经常掉线,每次登录消耗的流量较大(通常有5次交互流程)。其具体原因为,现有XMPP技术方案中,每次会话建立都包括能力协商,鉴权认证,建立会话等流程,包括多组涉及能力协商、认证鉴权和会话建立的交互消息。在移动通信环境下,频繁的上下线,导致了频繁的执行对应的一整套登录流程。通过实践证明,现有技术方案下,在对应服务器不变的情况下,XMPP客户端的多次登录所进行的多次能力协商结果是相似的。因此,对于同一服务器而言,只有首次登录,能力协商是有意义的,后面再次登录同一个服务器,完全不需要再次进行能力协商了。However, the XMPP protocol has been criticized in the mobile field. One of the important reasons is the problem of large traffic consumption. The login process accounts for a large proportion of traffic consumption. In the mobile environment, users frequently go online and offline, often falling off. Line, the traffic consumed per login is large (usually there are 5 interaction processes). The specific reason is that in the existing XMPP technical solution, each session establishment includes a capability negotiation, an authentication authentication, a session establishment process, and the like, and includes multiple sets of interaction messages involving capability negotiation, authentication authentication, and session establishment. In the mobile communication environment, frequent online and offline, resulting in frequent execution of a corresponding set of login processes. It has been proved by practice that under the prior art scheme, the multiple capability negotiation results of multiple logins of the XMPP client are similar when the corresponding server is unchanged. Therefore, for the same server, only the first login, the capability negotiation is meaningful, and then log in to the same server again, there is no need to perform capability negotiation again.
因此,结合现有技术方案中XMPP客户端登录的流程特性,可以进一步简化登录/会话建立过程的流程复杂度,减小流量消耗,最终也相应减小服务器的处理压力。Therefore, combined with the process characteristics of the XMPP client login in the prior art solution, the process complexity of the login/session establishment process can be further simplified, the traffic consumption is reduced, and the processing pressure of the server is reduced accordingly.
发明内容Summary of the invention
以下是对本文详细描述的主题的概述,本概述并非是为了限制权利要求 的保护范围。The following is a summary of the subject matter described in detail herein, and is not intended to limit the claim The scope of protection.
为了解决上述技术问题,本文公开了一种基于XMPP协议实现的一种会话建立的方法、终端和服务器。In order to solve the above technical problem, a method, a terminal and a server for establishing a session based on the XMPP protocol are disclosed.
本文公开了一种登录的方法,包括:This document discloses a method of logging in, including:
基于可扩展通讯和表示协议XMPP进行通信;Communication based on scalable communication and presentation protocol XMPP;
首次登录后,保存首次登录时与服务器协商获得的登录参数;After logging in for the first time, save the login parameters obtained by negotiation with the server when logging in for the first time;
非首次登录时,直接采用保存的所述登录参数建立会话,完成登录。When the first login is not performed, the saved login parameters are used to establish a session and the login is completed.
所述服务器设定登录参数有效时间;Setting the login parameter valid time by the server;
超过所述登录参数有效时间后,非首次登录时,登录失败;重新登录,与所述服务器协商获得新的登录参数,并保存为所述登录参数。After the login parameter is valid, the login fails when not logging in for the first time; re-login, negotiate with the server to obtain a new login parameter, and save as the login parameter.
所述登录参数,包括:服务器能力集参数和/或鉴权参数。The login parameter includes: a server capability set parameter and/or an authentication parameter.
所述登录参数,还包括:登录属性;所述登录属性指示在非首次登录时直接采用保存的所述登录参数进行登录。The login parameter further includes: a login attribute, where the login attribute indicates that the login parameter is directly used to log in when not logging in for the first time.
所述登录参数,还包括:登录参数有效时间。The login parameter further includes: a login parameter valid time.
本文还公开了一种基于可扩展通讯和表示协议XMPP的终端,包括:通信单元、登录参数协商单元和会话建立单元,其中,The invention also discloses a terminal based on the extensible communication and presentation protocol XMPP, comprising: a communication unit, a login parameter negotiation unit and a session establishment unit, wherein
通信单元,设置为基于可扩展通讯和表示协议XMPP与服务器进行通信;a communication unit configured to communicate with the server based on the extensible communication and presentation protocol XMPP;
登录参数协商单元,设置为登录服务器,保存与所述服务器协商获得的登录参数;The login parameter negotiation unit is configured to log in to the server, and save the login parameters obtained by negotiation with the server;
会话建立单元,设置为在非首次登录时,直接采用保存的所述登录参数与服务器建立会话,完成登录。The session establishing unit is configured to establish a session with the server directly by using the saved login parameter when the first login is not performed, and complete the login.
所述服务器设定登录参数有效时间;超过所述登录参数的时间后,在非首次登录时,所述会话建立单元与所述服务器建立会话失败;The server sets a login parameter valid time; after the time of the login parameter is exceeded, the session establishment unit fails to establish a session with the server when the first login is not performed;
所述登录参数协商单元,还设置为在所述会话建立单元与所述服务器建 立会话失败后,重新登录,与所述服务器协商获得新的登录参数,并保存为所述登录参数。The login parameter negotiation unit is further configured to be established in the session establishing unit and the server After the session fails, log in again, negotiate with the server to obtain a new login parameter, and save it as the login parameter.
所述登录参数,包括:所述服务器能力集参数和/或鉴权参数。The login parameter includes: the server capability set parameter and/or an authentication parameter.
可选地,所述登录参数,还包括:登录属性;所述登录属性指示在非首次登录时直接采用保存的所述登录参数建立会话。Optionally, the login parameter further includes: a login attribute, where the login attribute indicates that the session is established by using the saved login parameter directly when not logging in for the first time.
可选地,所述登录参数,还包括:登录参数有效时间。Optionally, the login parameter further includes: a login parameter valid time.
所述会话建立单元,还设置为在非首次登录时,根据所述登录参数有效时间,判断是否超过所述登录参数有效时间,如果超过,则通知所述登录参数协商单元重新执行首次登录;如果未超过,则直接采用保存的所述登录参数与所述服务器建立会话,完成登录;相应地,所述登录参数协商单元,还设置为重新登录所述服务器,与所述服务器协商获得新的登录参数,并保存为所述登录参数。The session establishing unit is further configured to determine, according to the valid time of the login parameter, that the login parameter valid time is exceeded, and if not, notify the login parameter negotiation unit to re-execute the first login; If not, the session is established by using the saved login parameter to establish a session with the server, and the login is completed. Correspondingly, the login parameter negotiation unit is further configured to log in to the server again, and negotiate a new login with the server. Parameters and saved as the login parameters.
可选的,所述会话建立单元,还设置为在非首次登录时,根据所述登录属性,判断是否直接采用保存的所述登录参数与服务器建立会话,如果是,则直接采用保存的所述登录参数与服务器建立会话,完成登录;如果不是,则通知所述登录参数协商单元重新执行首次登录;相应地,所述登录参数协商单元,还设置为重新登录所述服务器,与所述服务器协商获得新的登录参数,并保存为所述登录参数。Optionally, the session establishing unit is further configured to determine, according to the login attribute, whether to establish a session with the server directly by using the saved login parameter when the first login is not performed, and if yes, directly adopting the saved The login parameter establishes a session with the server to complete the login; if not, the login parameter negotiation unit is notified to re-execute the first login; accordingly, the login parameter negotiation unit is further configured to re-login to the server and negotiate with the server. Obtain new login parameters and save as the login parameters.
本问还公开了一种会话建立的方法,包括:This question also discloses a method for session establishment, including:
基于可扩展通讯和表示协议XMPP进行通信;Communication based on scalable communication and presentation protocol XMPP;
接收登录请求,判断是否为首次登录请求;Receiving a login request to determine whether it is a first login request;
所述登录请求为首次登录请求时,与客户端协商确定登录参数,建立会话;指示所述客户端保存所述登录参数;When the login request is the first login request, the client negotiates with the client to determine the login parameter, establishes a session, and instructs the client to save the login parameter.
所述登录请求为非首次登录请求时,采用所述非首次登录请求中携带的所述登录参数与客户端建立会话。When the login request is a non-first login request, the session is established with the client by using the login parameter carried in the non-first login request.
预先设定登录参数有效时间; Pre-set the login parameter effective time;
接收非首次登录请求,判断请求时间超过所述登录参数有效时间后,返回会话建立失败指令,指示客户端执行首次登录流程。After receiving the non-first login request, determining that the request time exceeds the valid time of the login parameter, returning a session establishment failure instruction, instructing the client to perform the first login process.
所述登录参数,包括:服务器能力集参数和/或鉴权参数。The login parameter includes: a server capability set parameter and/or an authentication parameter.
可选地,所述登录参数,还包括:登录属性;所述登录属性指示客户端在非首次登录时直接采用保存的所述登录参数请求建立会话。Optionally, the login parameter further includes: a login attribute, where the login attribute indicates that the client directly uses the saved login parameter to establish a session when not logging in for the first time.
可选地,所述登录参数,还包括:登录参数有效时间。Optionally, the login parameter further includes: a login parameter valid time.
本文还公开了一种基于可扩展通讯和表示协议XMPP的服务器,其特征在于,包括:通信单元、首次登录单元和快速登录单元;其中,The invention also discloses a server based on the extensible communication and presentation protocol XMPP, which comprises: a communication unit, a first login unit and a quick login unit; wherein
通信单元,设置为基于可扩展通讯和表示协议XMPP与客户端进行通信;接收客户端登录请求,判断是否为首次登录请求;a communication unit configured to communicate with the client based on the extensible communication and presentation protocol XMPP; receiving a client login request to determine whether it is a first login request;
首次登录单元,设置为接收首次登录请求时,与所述客户端协商确定登录参数,建立会话;指示所述客户端保存所述登录参数;The first login unit is configured to: when receiving the first login request, negotiate with the client to determine a login parameter, establish a session; and instruct the client to save the login parameter;
快速登录单元,设置为接收非首次登录请求时,采用所述非首次登录请求中携带的所述登录参数与客户端建立会话。The quick login unit is configured to establish a session with the client by using the login parameter carried in the non-first login request when receiving the non-first login request.
所述快速登录单元,还设置为设定登录参数有效时间;The quick login unit is further configured to set a login parameter valid time;
所述快速登录单元,还设置为在客户端登录时间超过所述登录参数有效时间后,接收所述非首次登录请求时,返回会话建立失败指令,指示客户端执行首次登录流程。The quick login unit is further configured to return a session establishment failure instruction when the client login time exceeds the valid time of the login parameter, and when the non-first login request is received, instruct the client to perform the first login process.
所述登录参数,包括:所述服务器能力集参数和/或鉴权参数。The login parameter includes: the server capability set parameter and/or an authentication parameter.
可选地,登录参数还包括:登录属性;所述登录属性指示客户端在非首次登录时直接采用保存的所述登录参数与所述服务器建立会话。Optionally, the login parameter further includes: a login attribute, where the login attribute indicates that the client establishes a session with the server by using the saved login parameter directly when not logging in for the first time.
可选地,登录参数还包括:登录参数有效时间。Optionally, the login parameter further includes: a login parameter valid time.
本发明实施例提供的技术方案中,客户端在非首次登录时,无需遵循现有XMPP协议的规范进行完整的登录流程,直接采用客户端所保存的历史登录过程中所协商确定的登录参数建立会话,完成登录。大大简化了现有 XMPP方案的非首次登录流程,针对移动通信领域XMPP客户端频繁上下线的业务现状,大大减少了网络流量的消耗,同时减轻了服务器的压力。In the technical solution provided by the embodiment of the present invention, the client does not need to follow the specifications of the existing XMPP protocol to perform a complete login process, and directly establishes the login parameters negotiated in the historical login process saved by the client. Session, complete login. Greatly simplifies existing The non-first-time login process of the XMPP solution, which is aimed at the frequent and offline business of the XMPP client in the mobile communication field, greatly reduces the consumption of network traffic and reduces the pressure on the server.
在阅读并理解了附图和详细描述后,可以明白其他方面。Other aspects will be apparent upon reading and understanding the drawings and detailed description.
附图概述BRIEF abstract
图1为现有技术的XMPP客户端登录流程;FIG. 1 is a prior art XMPP client login process;
图2为本发明实施例一提供的登录服务器的方法流程图;2 is a flowchart of a method for logging in to a server according to Embodiment 1 of the present invention;
图3为本发明实施一、三提供的登录服务器的消息流程图;3 is a message flow chart of a login server provided by Embodiments 1 and 3 of the present invention;
图4为本发明实施例二提供的终端的结构图;4 is a structural diagram of a terminal according to Embodiment 2 of the present invention;
图5为本发明实施例三提供的建立会话的方法流程图;FIG. 5 is a flowchart of a method for establishing a session according to Embodiment 3 of the present invention;
图6为本发明实施例四提供的服务器的结构图。FIG. 6 is a structural diagram of a server according to Embodiment 4 of the present invention.
本发明的较佳实施方式Preferred embodiment of the invention
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合附图及具体实施例对本发明实施例的方案作进一步的详细描述。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互任意组合。The embodiments of the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that, in the case of no conflict, the features in the embodiments and the embodiments in the present application may be arbitrarily combined with each other.
现有技术方案中,XMPP客户端进行服务器登录的过程如图1所示,包括:In the prior art solution, the process of the server login by the XMPP client is as shown in FIG. 1 , including:
1、客户端打开stream,发起服务器能力查询;服务器返回服务器能力信息;(指示客户端需要进行哪种认证鉴权)1. The client opens the stream and initiates a server capability query; the server returns server capability information; (indicating which authentication authentication the client needs to perform)
2、客户端根据服务器指示,发起认证鉴权;服务器返回认证结果;2. The client initiates authentication and authentication according to the server indication; the server returns the authentication result;
3、客户端发起服务器能力查询;服务器返回服务器能力信息;(指示客户端可以进行哪种绑定)3. The client initiates a server capability query; the server returns server capability information; (indicating which binding the client can perform)
4、客户端发起资源绑定请求;服务器返回绑定请求结果;4. The client initiates a resource binding request; the server returns a binding request result;
5、客户端与服务器建立会话,完成登录。5. The client establishes a session with the server and completes the login.
通过实践证明,在图1所示的现有技术方案下,在对应服务器不变的情 况下,XMPP客户端的多次登录所进行的多次能力协商结果是相似的。因此,对于同一服务器而言,只有首次登录,能力协商是有意义的,后面再次登录同一个服务器,在服务器无变化时,可以不需要再次进行能力协商。It has been proved by practice that under the prior art scheme shown in FIG. 1, the corresponding server is unchanged. In this case, the results of multiple capability negotiations performed by multiple logins of the XMPP client are similar. Therefore, for the same server, only the first login, the capability negotiation is meaningful, and then log in to the same server again. When there is no change in the server, the capability negotiation may not be performed again.
针对该特点,为了解决移动通信环境下XMPP客户端频繁执行全流程的登录流程,导致的流量浪费和对服务器造成的巨大压力,本文公开了一种登录服务器的方法、终端、会话建立的方法和服务器。Aiming at this feature, in order to solve the problem that the XMPP client frequently performs the full-process login process in the mobile communication environment, resulting in waste of traffic and great pressure on the server, this paper discloses a method, terminal, and session establishment method for logging in to the server. server.
实施例一:Embodiment 1:
一种登录的方法,如图2所示,客户端基于可扩展通讯和表示协议XMPP与服务器进行通信;具体过程如下:A login method, as shown in Figure 2, the client communicates with the server based on the scalable communication and presentation protocol XMPP; the specific process is as follows:
步骤201:判断是否是首次登录;如果是,则执行步骤202;如果不是则执行步骤203;Step 201: Determine whether it is the first time login; if yes, go to step 202; if not, go to step 203;
步骤202:执行现有技术方案中的普通登录流程,登录后,保存该普通登录流程中与服务器协商确定的登录参数;Step 202: Perform a normal login process in the prior art solution, and after login, save the login parameters determined by the server in the normal login process.
步骤203:不执行现有技术方案中的普通登录流程,直接采用所保存的登录参数建立会话,完成登录。Step 203: The ordinary login process in the prior art solution is not executed, and the saved login parameter is directly used to establish a session, and the login is completed.
可选地,步骤203包括:Optionally,
服务器预先设定登录参数有效时间;The server presets the login parameter valid time;
当客户端的登录时间超过该登录参数有效时间后,直接采用所保存的登录参数建立会话,建立会话失败;失败后,重新执行普通登录流程,协商获得新的登录参数,并保存,覆盖历史保存的登录参数。After the login time of the client exceeds the valid time of the login parameter, the session is established by using the saved login parameters. The session fails to be established. After the failure, the normal login process is re-executed, the new login parameters are obtained, and the history is saved. Login parameters.
上述步骤中的登录参数,包括:服务器能力集参数和/或鉴权参数;The login parameters in the above steps include: a server capability set parameter and/or an authentication parameter;
其中,服务器能力集参数,指示服务器所支持XMPP会话建立的能力要求,该能力要求包括以下的一项或多项:The server capability set parameter indicates a capability requirement for the XMPP session establishment supported by the server, and the capability requirement includes one or more of the following:
TLS(Tansport Layer Security)策略、SASL(Simple Authentication Security Layer)策略、服务器支持的SASL认证机制、是否支持zlib压缩和终端绑定策略; TLS (Tansport Layer Security) policy, SASL (Simple Authentication Security Layer) policy, server-supported SASL authentication mechanism, whether to support zlib compression and terminal binding policy;
鉴权参数,指示成功登录时所使用的鉴权参数,包括以下的一项或多项:The authentication parameter indicates the authentication parameters used when successfully logging in, including one or more of the following:
选定的TLS策略、选定的SASL认证机制、是否采用zlib压缩、选定的终端绑定策略、鉴权用户名和鉴权用户密码;Selected TLS policy, selected SASL authentication mechanism, whether to use zlib compression, selected terminal binding policy, authentication username and authentication user password;
上述登录参数中所包括的具体的服务器能力集参数和/或鉴权参数,不限于本实施例所例举的内容,包括现有技术方案中普通登录过程中协商确定并使用的登录参数。The specific server capability set parameters and/or the authentication parameters included in the foregoing login parameters are not limited to the contents exemplified in the embodiment, and include the login parameters negotiated and used in the normal login process in the prior art solution.
可选地,上述步骤中的登录参数,还包括:登录属性,指示客户端在非首次登录时直接采用保存的所述登录参数进行登录,当服务器支持直接采用保存的登录参数进行登录,即服务器支持快速登录流程时,指示客户端可以直接采用保存的登录参数进行登录;这里的快速登录流程是指不执行现有技术方案中的普通登录流程,不进行客户端与服务器之间的能力协商,客户端采用本地保存的登录参数发起非首次登录请求,服务器采用客户端发送的非首次登录请求中携带的登录参数与客户端建立会话,完成登录。Optionally, the login parameter in the foregoing step further includes: a login attribute, indicating that the client directly logs in using the saved login parameter when not logging in for the first time, and when the server supports directly using the saved login parameter to log in, that is, the server When the fast login process is supported, the client can directly log in using the saved login parameters. The fast login process here does not perform the normal login process in the prior art solution, and does not perform capability negotiation between the client and the server. The client uses the locally saved login parameters to initiate a non-first login request. The server establishes a session with the client by using the login parameters carried in the non-first login request sent by the client to complete the login.
当登录参数中包括登录属性时,步骤201可以相应替换为:When the login attribute includes the login attribute, step 201 can be replaced by:
判断是否是首次登录;如果是首次登录,则执行步骤202;如果不是首次登录,则进一步判断登录属性是否指示在非首次登录时直接采用保存的所述登录参数建立会话,如果指示可以在非首次登录时直接采用保存的所述登录参数建立会话,则执行步骤203,该情况表明服务器支持直接采用保存的登录参数进行登录;如果指示不可以在非首次登录时直接采用保存的所述登录参数建立会话,则执行步骤202,该情况表明服务器不支持支持采用保存的登录参数进行登录。Determining whether it is the first login; if it is the first login, executing
该登录参数中还包括登录参数有效时间,表示允许客户端使用所保存的历史登录参数进行登录的有效时间。The login parameter also includes a valid time of the login parameter, indicating a valid time for allowing the client to log in using the saved historical login parameter.
当服务器上述相关能力发生调整时,服务器调整该登录参数有效时间,使调整后的登录参数有效时间小于当前时间,这时直接采用所保存的登录参数与服务器建立会话将失败;失败后,重新执行首次登录流程,协商获得新 的登录参数,并保存,覆盖历史保存的登录参数。When the related capacity of the server is adjusted, the server adjusts the valid time of the login parameter, so that the adjusted login parameter valid time is less than the current time. At this time, the session established by using the saved login parameter directly fails to be established; The first login process, negotiated to get new The login parameters are saved and overwritten with the history saved login parameters.
可选的,步骤203还包括:Optionally, step 203 further includes:
客户端查找本地保存的登录参数;如果找到,则直接采用所保存的登录参数建立会话,完成登录;如果没有找到,则重新执行普通登录流程,协商获得新的登录参数,并保存,覆盖历史保存的登录参数;The client searches for the locally saved login parameters. If found, the session is established by using the saved login parameters to complete the login. If not found, the normal login process is re-executed, the new login parameters are obtained, and the history is saved. Login parameter;
或者,or,
客户端根据本地保存的登录参数中所包括的登录参数有效时间,判断当前登录时间是否超过该有效时间;如果没有超过,即,在有效时间范围内,则直接采用所保存的登录参数建立会话,完成登录;如果超过,则重新执行普通登录流程,协商获得新的登录参数,并保存,覆盖历史保存的登录参数。The client determines whether the current login time exceeds the valid time according to the valid time of the login parameter included in the locally saved login parameter; if not, that is, within the valid time range, the session is directly established by using the saved login parameter. Complete the login; if it is exceeded, re-execute the normal login process, negotiate to obtain new login parameters, and save, overwriting the historically saved login parameters.
结合登录的消息流,当协商确定的登录参数包括登录属性时,扩展现有登录流程中的消息,实现步骤202,可以为:In combination with the logged-in message flow, when the login parameter determined by the negotiation includes the login attribute, the message in the existing login process is extended, and step 202 is implemented, which may be:
服务器扩展返回消息中的FEATURE字段,增加登录属性字段,表明服务器支持直接采用保存的登录参数进行登录;The server extension returns the FEATURE field in the message, and adds the login attribute field, indicating that the server supports direct login using the saved login parameters.
当协商确定的登录参数还包括登录参数有效时间时,扩展现有消息,实现步骤202,可以为:When the login parameter determined by the negotiation further includes the valid time of the login parameter, the existing message is extended, and step 202 is implemented, which may be:
服务器扩展返回消息中的FEATURE字段,增加登录参数有效时间,表明当前服务器设定的登录参数的有效时间;The server extension returns the FEATURE field in the message, and increases the effective time of the login parameter, indicating the effective time of the login parameter set by the current server;
具体选择对现有登录流程中的哪个返回消息进行扩展,不限于本实施例中所述的返回消息和具体字段,可以选择普通登录流程中任意一个服务器返回消息进行扩展,都能达到登录成功后,客户端能够获知相关登录参数,并指示客户端保存所需登录参数的目的。The specific selection of which return message in the existing login process is extended, and is not limited to the return message and the specific field described in this embodiment. You can select any server in the normal login process to return the message for expansion. The client can learn the relevant login parameters and instruct the client to save the required login parameters.
可选地,结合如图3所示的消息流,实现步骤203可以为:Optionally, in combination with the message flow shown in FIG. 3, the
步骤301:客户端从本地获得已保存的登录参数,将登录认证所需参数 包括在认证消息(AUTH)中,发送给服务器;Step 301: The client obtains the saved login parameter locally, and the required parameters for the login authentication Included in the authentication message (AUTH), sent to the server;
步骤302:服务器接收认证消息,进行认证,认证成功后返回成功消息;Step 302: The server receives the authentication message, performs authentication, and returns a success message after the authentication succeeds;
步骤303:客户端从本地获得已保存的登录参数,将执行客户端绑定所需参数包括在绑定消息(IQ(SET BIND))中,发送给服务器;Step 303: The client obtains the saved login parameter locally, and the parameters required for performing the client binding are included in the binding message (IQ (SET BIND)), and are sent to the server;
步骤304:服务器接收绑定消息,执行绑定,返回绑定成功;建立会话,完成登录。Step 304: The server receives the binding message, performs binding, returns the binding success, establishes a session, and completes the login.
实施例二:Embodiment 2:
本文还公开了一种基于可扩展通讯和表示协议XMPP的终端,如图4所示,包括:通信单元,登录参数协商单元和会话建立单元;Also disclosed herein is a terminal based on scalable communication and presentation protocol XMPP, as shown in FIG. 4, comprising: a communication unit, a login parameter negotiation unit and a session establishment unit;
通信单元,设置为基于可扩展通讯和表示协议XMPP与服务器进行通信;a communication unit configured to communicate with the server based on the extensible communication and presentation protocol XMPP;
登录参数协商单元,设置为在首次登录时,保存与所述服务器协商获得的登录参数;The login parameter negotiation unit is configured to save the login parameter obtained by negotiation with the server when logging in for the first time;
会话建立单元,设置为在非首次登录时,直接采用保存的所述登录参数与服务器建立会话,完成登录。The session establishing unit is configured to establish a session with the server directly by using the saved login parameter when the first login is not performed, and complete the login.
其中,服务器设定登录参数有效时间;超过设定的登录参数的有效时间后,会话建立单元与服务器建立会话失败;The server sets the login parameter valid time; after the valid time of the set login parameter is exceeded, the session establishment unit fails to establish a session with the server;
登录参数,包括:所述服务器能力集参数和/或鉴权参数;The login parameter includes: the server capability set parameter and/or the authentication parameter;
可选地,登录参数还包括:登录属性;登录属性指示客户端在非首次登录时直接采用保存的所述登录参数建立会话;Optionally, the login parameter further includes: a login attribute; the login attribute indicates that the client directly establishes the session by using the saved login parameter when not logging in for the first time;
可选地,登录参数还包括:登录参数有效时间。Optionally, the login parameter further includes: a login parameter valid time.
登录参数协商单元,还设置为在所述会话建立单元与所述服务器建立会话失败后,重新登录,与所述服务器协商获得新的登录参数,并保存为所述登录参数。 The login parameter negotiation unit is further configured to: after the session establishment unit fails to establish a session with the server, log in again, negotiate with the server to obtain a new login parameter, and save the login parameter as the login parameter.
会话建立单元,还设置为在非首次登录时,根据所述登录参数有效时间,判断是否超过所述登录参数有效时间,如果超过,则通知所述登录参数协商单元进行重新执行首次登录;如果未超过,则直接采用保存的所述登录参数与所述服务器建立会话,完成登录;相应地,所述登录参数协商单元,还设置为重新登录所述服务器,与所述服务器协商获得新的登录参数,并保存为所述登录参数。The session establishing unit is further configured to determine, according to the valid time of the login parameter, that the login parameter valid time is exceeded, and if not, notify the login parameter negotiation unit to perform the first login again; if not If yes, the session is established with the saved login parameter to complete the login; correspondingly, the login parameter negotiation unit is further configured to log in to the server again, and negotiate with the server to obtain a new login parameter. And saved as the login parameter.
会话建立单元,还设置为在非首次登录时,根据所述登录属性,判断是否直接采用保存的所述登录参数与服务器建立会话,如果是,则直接采用保存的所述登录参数与服务器建立会话,完成登录;如果不是,则通知所述登录参数协商单元重新执行首次登录;相应地,所述登录参数协商单元,还设置为重新登录所述服务器,与所述服务器协商获得新的登录参数,并保存为所述登录参数。The session establishing unit is further configured to, according to the login attribute, determine whether to directly establish a session with the server by using the saved login parameter, and if yes, directly establish a session with the server by using the saved login parameter. And completing the login; if not, notifying the login parameter negotiation unit to re-execute the first login; correspondingly, the login parameter negotiation unit is further configured to re-login to the server, and negotiate with the server to obtain a new login parameter, And saved as the login parameter.
实施例三Embodiment 3
一种会话建立的方法,如图5所示,A method of session establishment, as shown in FIG.
服务器基于可扩展通讯和表示协议XMPP与客户端进行通信,包括:The server communicates with the client based on the Extensible Communication and Presentation Protocol XMPP, including:
步骤501:接收登录请求,Step 501: Receive a login request,
步骤502:判断是否为首次登录请求;当该登录请求为首次登录请求时,执行步骤503,当该登录请求为非首次登录请求时,执行步骤504;Step 502: Determine whether it is a first login request; when the login request is a first login request,
步骤503:,执行普通登录流程与客户端协商确定登录参数,建立会话;指示客户端保存登录参数;Step 503: Perform a normal login process to negotiate with the client to determine a login parameter, establish a session, and instruct the client to save the login parameter.
步骤504:采用所述非首次登录请求中携带的登录参数与客户端建立会话。Step 504: Establish a session with the client by using the login parameter carried in the non-first login request.
可选地,服务器设定登录参数有效时间;Optionally, the server sets a login parameter valid time;
接收非首次登录请求,判断请求时间超过所述登录参数有效时间后,返回会话建立失败指令,指示客户端执行首次登录流程;未超过登录参数有效时间时,则采用所述非首次登录请求中携带的所述登录参数与客户端建立会话,完成登录。 Receiving a non-first login request, determining that the request time exceeds the valid time of the login parameter, returning a session establishment failure instruction, instructing the client to perform the first login process; and not exceeding the effective time of the login parameter, carrying the non-first login request The login parameter establishes a session with the client to complete the login.
本实施例中,登录参数,包括:服务器能力集参数和/或鉴权参数。In this embodiment, the login parameters include: a server capability set parameter and/or an authentication parameter.
服务器能力集参数,指示服务支持XMPP会话建立的能力要求,该能力要求以下的一项或多项:The server capability set parameter indicates the capability requirement of the service to support XMPP session establishment, which requires one or more of the following:
TLS(Tansport Layer Security)策略、SASL(Simple Authentication Security Layer)策略、服务器支持的SASL认证机制、是否支持zlib压缩或终端绑定策略;TLS (Tansport Layer Security) policy, SASL (Simple Authentication Security Layer) policy, server-supported SASL authentication mechanism, whether to support zlib compression or terminal binding policy;
鉴权参数,指示成功登录时所使用的鉴权参数,包括以下的一项或多项:The authentication parameter indicates the authentication parameters used when successfully logging in, including one or more of the following:
选定的TLS策略、选定的SASL认证机制、是否采用zlib压缩、选定的终端绑定策略、鉴权用户名或鉴权用户密码;Selected TLS policy, selected SASL authentication mechanism, whether to use zlib compression, selected terminal binding policy, authentication user name or authentication user password;
上述登录参数中所包括的具体的服务器能力集参数和/或鉴权参数,不限于本实施例所例举的内容,包括现有技术方案中普通登录过程中协商确定并使用的登录参数。The specific server capability set parameters and/or the authentication parameters included in the foregoing login parameters are not limited to the contents exemplified in the embodiment, and include the login parameters negotiated and used in the normal login process in the prior art solution.
可选地,本实施例中上述步骤中的登录参数,还包括:登录属性,指示客户端在非首次登录时直接采用保存的所述登录参数请求建立会话,当服务器支持直接采用保存的登录参数进行登录,即服务器支持快速登录流程时,指示客户端在非首次登录时直接采用保存的所述登录参数请求建立会话;这里的快速登录流程是指不执行现有技术方案中的普通登录流程,不进行客户端与服务器之间的能力协商,直接采用客户端发送的非首次登录请求中携带的登录参数与客户端建立会话,完成登录。Optionally, the login parameter in the foregoing step in the embodiment further includes: a login attribute, indicating that the client directly uses the saved login parameter to request to establish a session when not logging in for the first time, and the server supports directly adopting the saved login parameter. Logging in, that is, when the server supports the fast login process, the client is instructed to establish a session by using the saved login parameter when the first login is not performed; the fast login process here does not perform the normal login process in the prior art solution. If the capability negotiation between the client and the server is not performed, the login parameter carried in the non-first login request sent by the client is used to establish a session with the client to complete the login.
可选地,当登录参数中包括登录属性时,扩展现有消息内容,可以为:Optionally, when the login parameter includes the login attribute, the existing message content is extended, which may be:
服务器扩展现有技术方案中的返回消息的FEATURE字段,增加登录属性字段,表明服务器支持直接采用保存的登录参数进行登录。The server extends the FEATURE field of the return message in the prior art scheme, and adds a login attribute field, indicating that the server supports direct login using the saved login parameter.
该登录参数中还包括登录参数有效时间,表示服务器允许客户端使用所保存的历史登录参数进行登录的有效时间;The login parameter further includes a valid time of the login parameter, indicating a valid time for the server to allow the client to log in using the saved historical login parameter;
当登录参数中还包括登录参数有效时间时,扩展现有消息内容,可以为:When the login parameter also includes the login parameter valid time, the existing message content is extended, which can be:
服务器扩展现有技术方案中的返回消息的FEATURE字段,增加登录参 数有效时间,表明当前服务器设定的登录参数的有效时间。The server extends the FEATURE field of the returned message in the prior art scheme, and adds the login parameter. The number of valid times indicates the effective time of the login parameters set by the current server.
具体选择对哪个现有技术方案中的返回消息进行扩展,在本发明实施例中不具体限定,选择普通登录流程中任意一个服务器返回消息进行扩展,都能达到登录成功后,客户端能够获知相关登录参数的目的。Specifically, the method for extending the return message in the prior art solution is not specifically limited in the embodiment of the present invention, and any server in the normal login process is selected to return the message for extension, and the client can learn relevant after the login is successful. The purpose of the login parameter.
当服务器上述相关能力发生调整时,调整该登录参数有效时间,使调整后的登录参数有效时间小于当前时间,这时直接采用所保存的登录参数建立会话时,建立会话失败;指示客户端重新执行首次登录流程,协商获得新的登录参数,并保存,覆盖历史保存的登录参数。When the related capacity of the server is adjusted, the effective time of the login parameter is adjusted, so that the adjusted login parameter valid time is less than the current time. When the session is established by using the saved login parameter, the session fails to be established; the client is instructed to re-execute. The first login process, negotiated to obtain new login parameters, and save, overwriting historically saved login parameters.
可选地,接收的非首次登录请求执行过程,结合具体的消息流,如图3所示,可以为:Optionally, the received non-first login request execution process, combined with the specific message flow, as shown in FIG. 3, may be:
步骤301:接收客户端发送的扩展后的认证消息(AUTH),其中,包括登录认证所需参数;Step 301: Receive an extended authentication message (AUTH) sent by the client, where the parameter required for login authentication is included;
步骤302:执行认证,认证成功后返回成功消息;Step 302: Perform authentication, and return a success message after the authentication succeeds;
步骤303:接收客户端发送的扩展后的绑定消息(IQ(SET BIND)),其中保留执行客户端绑定所需参数;Step 303: Receive an extended binding message (IQ (SET BIND)) sent by the client, where the parameters required to perform client binding are retained;
步骤304:执行绑定,返回绑定成功,指示客户端保存本次登录参数;建立会话。Step 304: Perform binding, return binding success, instruct the client to save the current login parameter; establish a session.
实施例四:Embodiment 4:
一种基于可扩展通讯和表示协议XMPP的服务器,如图5所示,包括通信单元、首次登录单元和快速登录单元;A server based on scalable communication and presentation protocol XMPP, as shown in FIG. 5, comprising a communication unit, a first login unit, and a fast login unit;
通信单元,设置为基于可扩展通讯和表示协议XMPP与客户端进行通信;接收客户端登录请求,判断是否为首次登录请求;a communication unit configured to communicate with the client based on the extensible communication and presentation protocol XMPP; receiving a client login request to determine whether it is a first login request;
首次登录单元,设置为接收首次登录请求时,与所述客户端协商确定登录参数,建立会话;指示所述客户端保存所述登录参数; The first login unit is configured to: when receiving the first login request, negotiate with the client to determine a login parameter, establish a session; and instruct the client to save the login parameter;
快速登录单元,设置为接收非首次登录请求时,采用所述非首次登录请求中携带的所述登录参数与客户端建立会话。The quick login unit is configured to establish a session with the client by using the login parameter carried in the non-first login request when receiving the non-first login request.
可选地,快速登录单元,还设置为设定登录参数有效时间;在客户端登录时间超过所述登录参数有效时间后,接收所述非首次登录请求时,返回会话建立失败指令,指示客户端执行首次登录流程。Optionally, the fast login unit is further configured to set a login parameter valid time; after the client login time exceeds the valid time of the login parameter, when the non-first login request is received, returning a session establishment failure instruction, indicating the client Perform the first login process.
本实施中,所述登录参数,包括:所述服务器能力集参数和/或鉴权参数;In this implementation, the login parameter includes: the server capability set parameter and/or an authentication parameter;
还包括:登录属性;所述登录属性指示客户端在非首次登录时直接采用保存的所述登录参数与服务器建立会话;The method further includes: a login attribute, where the login attribute indicates that the client directly establishes a session with the server by using the saved login parameter when not logging in for the first time;
可选地,当登录参数中包括登录属性时,扩展服务器返回给客户端的消息,可以为:Optionally, when the login parameter includes the login attribute, the message returned by the extension server to the client may be:
服务器扩展现有技术方案中的返回消息的FEATURE字段,增加登录属性字段,表明服务器支持直接采用保存的登录参数进行登录。The server extends the FEATURE field of the return message in the prior art scheme, and adds a login attribute field, indicating that the server supports direct login using the saved login parameter.
该登录参数中还包括登录参数有效时间,表明服务器允许客户端使用所保存的历史登录参数进行登录的有效时间;The login parameter further includes a valid time of the login parameter, indicating a valid time for the server to allow the client to log in using the saved historical login parameter;
当登录参数中还包括登录参数有效时间时,扩展服务器返回给客户端的消息,可以为:When the login parameter also includes the valid time of the login parameter, the message returned by the extension server to the client may be:
服务器扩展现有技术方案中的返回消息的FEATURE字段,增加登录参数有效时间,表明当前服务器设定的登录参数的有效时间。The server extends the FEATURE field of the return message in the prior art scheme, and increases the effective time of the login parameter, indicating the effective time of the login parameter set by the current server.
具体选择对哪个现有技术方案中的返回消息进行扩展,在本实施例中不具体限定,选择普通登录流程中任意一个服务器返回消息进行扩展,都能达到登录成功后,客户端能够获知相关登录参数的目的。The specific selection of the return message in the prior art solution is extended. In this embodiment, the server does not specifically limit, and any server in the normal login process is selected to return the message for expansion, and the client can obtain the relevant login after the login is successful. The purpose of the parameter.
当服务器相关能力发生调整时,调整服务器所设定的登录参数有效时间,使调整后的登录参数有效时间小于当前时间,这时当客户端直接采用所保存的登录参数建立会话时,建立会话失败;服务器指示客户端重新执行首次登录流程,协商获得新的登录参数,并保存,覆盖历史保存的登录参数。 When the server related capability is adjusted, adjust the effective time of the login parameter set by the server, so that the adjusted login parameter valid time is less than the current time. At this time, when the client directly establishes the session by using the saved login parameter, the session establishment fails. The server instructs the client to re-execute the first login process, negotiate to obtain new login parameters, and save, overwriting the historically saved login parameters.
本发明实施例提供的方法实施例,通过首次登录时保存登录参数,在非首次登录时直接利用所保存的登录参数,无需进行登录参数协商,简化了XMPP终端的登录流程,实现了快速登录。针对移动通信领域XMPP客户端频繁上下线的业务现状,大大减少了网络流量的消耗,同时减轻了服务器的压力。In the embodiment of the present invention, the login parameter is saved when the first login is performed, and the saved login parameter is directly used when the first login is not performed. The login parameter negotiation is not required, the login process of the XMPP terminal is simplified, and the fast login is implemented. For the current situation of XMPP clients frequently going online and offline in the mobile communication field, the consumption of network traffic is greatly reduced, and the pressure on the server is alleviated.
本领域普通技术人员可以理解上述实施例的全部或部分步骤可以使用计算机程序流程来实现,所述计算机程序可以存储于一计算机可读存储介质中,所述计算机程序在相应的硬件平台上(如系统、设备、装置、器件等)执行,在执行时,包括方法实施例的步骤之一或其组合。One of ordinary skill in the art will appreciate that all or a portion of the steps of the above-described embodiments can be implemented using a computer program flow, which can be stored in a computer readable storage medium, such as on a corresponding hardware platform (eg, The system, device, device, device, etc. are executed, and when executed, include one or a combination of the steps of the method embodiments.
可选地,上述实施例的全部或部分步骤也可以使用集成电路来实现,这些步骤可以被分别制作成一个个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。这样,本发明实施例不限制于任何特定的硬件和软件结合。Alternatively, all or part of the steps of the above embodiments may also be implemented by using an integrated circuit. These steps may be separately fabricated into individual integrated circuit modules, or multiple modules or steps may be fabricated into a single integrated circuit module. achieve. Thus, embodiments of the invention are not limited to any specific combination of hardware and software.
上述实施例中的各装置/功能模块/功能单元可以采用通用的计算装置来实现,它们可以集中在单个的计算装置上,也可以分布在多个计算装置所组成的网络上。The devices/function modules/functional units in the above embodiments may be implemented by a general-purpose computing device, which may be centralized on a single computing device or distributed over a network of multiple computing devices.
上述实施例中的各装置/功能模块/功能单元以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。上述提到的计算机可读取存储介质可以是只读存储器,磁盘或光盘等。When each device/function module/functional unit in the above embodiment is implemented in the form of a software function module and sold or used as a stand-alone product, it can be stored in a computer readable storage medium. The above mentioned computer readable storage medium may be a read only memory, a magnetic disk or an optical disk or the like.
本发明实施例提供的方案,通过首次登录时保存登录参数,在非首次登录时直接利用所保存的登录参数,无需进行登录参数协商,简化了XMPP终端的登录流程,实现了快速登录。针对移动通信领域XMPP客户端频繁上下线的业务现状,大大减少了网络流量的消耗,同时减轻了服务器的压力。 The solution provided by the embodiment of the present invention saves the login parameter when logging in for the first time, and directly uses the saved login parameter when not logging in for the first time, and does not need to perform login parameter negotiation, which simplifies the login process of the XMPP terminal and implements fast login. For the current situation of XMPP clients frequently going online and offline in the mobile communication field, the consumption of network traffic is greatly reduced, and the pressure on the server is alleviated.
Claims (22)
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510479110.5 | 2015-08-06 | ||
CN201510479110.5A CN106385356A (en) | 2015-08-06 | 2015-08-06 | Login method and terminal, session establishing method and server |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2016165477A1 true WO2016165477A1 (en) | 2016-10-20 |
Family
ID=57127086
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2016/074156 WO2016165477A1 (en) | 2015-08-06 | 2016-02-19 | Login method, terminal, session establishment method, and server |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN106385356A (en) |
WO (1) | WO2016165477A1 (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN119650028A (en) * | 2025-02-19 | 2025-03-18 | 温州医科大学附属第一医院 | Medical beauty equipment treatment data collection method and equipment |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107395626A (en) * | 2017-08-22 | 2017-11-24 | 四川长虹电器股份有限公司 | A kind of optimization method of raising separate unit Openfire servers length connection number |
CN109104499B (en) * | 2018-09-29 | 2021-11-05 | 上海达梦数据库有限公司 | Session establishing method, device, equipment and storage medium |
CN111865693B (en) * | 2020-07-23 | 2023-08-18 | 深圳市航天无线通信技术有限公司 | Automatic correction method, device, equipment and storage medium for network terminal networking parameters |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080307480A1 (en) * | 2007-06-07 | 2008-12-11 | Sony Corporation | Network system, message processing method, service server, direct access management server, network home appliance, and computer program |
CN102196434A (en) * | 2010-03-10 | 2011-09-21 | 中国移动通信集团公司 | Authentication method and system for wireless local area network terminal |
CN104468618A (en) * | 2014-12-26 | 2015-03-25 | 重庆邮电大学 | Sensor network based XMPP security access method |
CN104580537A (en) * | 2015-02-06 | 2015-04-29 | 深圳中兴网信科技有限公司 | Rapid reconnecting method based on XMPP (extensible messaging and presence protocol) client side, terminal and server |
-
2015
- 2015-08-06 CN CN201510479110.5A patent/CN106385356A/en not_active Withdrawn
-
2016
- 2016-02-19 WO PCT/CN2016/074156 patent/WO2016165477A1/en active Application Filing
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080307480A1 (en) * | 2007-06-07 | 2008-12-11 | Sony Corporation | Network system, message processing method, service server, direct access management server, network home appliance, and computer program |
CN102196434A (en) * | 2010-03-10 | 2011-09-21 | 中国移动通信集团公司 | Authentication method and system for wireless local area network terminal |
CN104468618A (en) * | 2014-12-26 | 2015-03-25 | 重庆邮电大学 | Sensor network based XMPP security access method |
CN104580537A (en) * | 2015-02-06 | 2015-04-29 | 深圳中兴网信科技有限公司 | Rapid reconnecting method based on XMPP (extensible messaging and presence protocol) client side, terminal and server |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN119650028A (en) * | 2025-02-19 | 2025-03-18 | 温州医科大学附属第一医院 | Medical beauty equipment treatment data collection method and equipment |
Also Published As
Publication number | Publication date |
---|---|
CN106385356A (en) | 2017-02-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11729594B2 (en) | Network access method, device, and system | |
US10034057B2 (en) | Message processing method, device, gateway, STB and IPTV | |
US11140162B2 (en) | Response method and system in virtual network computing authentication, and proxy server | |
US9787502B2 (en) | Captive portal systems, methods, and devices | |
US7448068B2 (en) | Automatic client authentication for a wireless network protected by PEAP, EAP-TLS, or other extensible authentication protocols | |
US20190281032A1 (en) | Dynamically Serving Digital Certificates Based on Secure Session Properties | |
US9646098B2 (en) | Session completion through co-browsing | |
US20120246226A1 (en) | System and method for sharing data from a local network to a remote device | |
CN108683679A (en) | More account login methods, device, equipment and the storage medium of Web APP | |
WO2017215614A1 (en) | Method, device and system for realising heart beat keepalive | |
EP3028437B1 (en) | Messaging api over http protocol to establish context for data exchange | |
EP2638712B1 (en) | Context-based dynamic policy system for mobile devices and supporting network infrastructure | |
US20140201366A1 (en) | Smartphone apps in a cloud | |
WO2016165477A1 (en) | Login method, terminal, session establishment method, and server | |
WO2014086222A1 (en) | Method and apparatus for setting video call parameters and sending capability parameters | |
US20150106529A1 (en) | Terminal apparatus and method for connecting to virtual server in virtual desktop infrastructure | |
JP4532238B2 (en) | On-demand service provision system | |
US8639750B2 (en) | Orchestration of web notifications | |
CN110392017B (en) | Method and related device for processing RPC message | |
CN104836793B (en) | request control method, server, client and system | |
JP2008217376A (en) | Content sharing method and system | |
WO2016015215A1 (en) | Data processing apparatus and method | |
CN119728619A (en) | Wallpaper sharing method, device and electronic device | |
JP2012150738A (en) | Connection control method of thin client |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 16779452 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 16779452 Country of ref document: EP Kind code of ref document: A1 |