android - 重复登录 怎么解决 比如两台设备同时登录一个账号
PHP中文网
PHP中文网 2017-04-17 17:32:25
0
6
1128

重复登录怎么解决比如两台设备同时登录一个账号

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(6)
Ty80

There are two types of solutions. The first type is proactive. When your second client logs in, the first client is notified to log out. This requires a long connection between the client and the server.
The second type is passive. When the client logs in, it will obtain a token, and every subsequent operation will bring the token. The token will be updated each time it logs in. Therefore, when the second logs in, the token of the first login will be used. It will be invalid, log out at this time

伊谢尔伦

You can integrate third parties such as Huanxin, which has a kick-out function for repeated logins. However, if it is just for this function, it is not necessary. It is better to design it through the interface.

洪涛

If you are chatting, it is a long connection, and the server can actively disconnect the user. Like QQ
If it is just for ordinary functions, tokens are used to squeeze out the other party's offline, but this must request the network interface to be effective. Generally, the interface design, each request head Zhongdu brings token information, but you can also send it directly to the client through push messages to prompt you to go offline.

阿神

If you do it yourself, use a custom message notification. When an account has been logged in and another device logs in to the account again, let the server send a notification to the first device. The device can log out after receiving the notification.
If you are using third-party instant messaging, it is relatively simple. After the account is logged in, the instant messaging will have a monitoring method. Just perform operations in this method

小葫芦

Generally, one account is not allowed to be logged in on two mobile phones. Unless there are special needs, you can go to the mobile phone device parameters for unique verification as account parameters

伊谢尔伦

Requires server-side classmates to make restrictions

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!