GithubHelp home page GithubHelp logo

Comments (10)

2881099 avatar 2881099 commented on July 4, 2024

断开了后重新连接一次

from freeim.

2881099 avatar 2881099 commented on July 4, 2024

这个在客户端做?

from freeim.

Tim1104 avatar Tim1104 commented on July 4, 2024

怎么踢人下线

from freeim.

Tim1104 avatar Tim1104 commented on July 4, 2024

API端

from freeim.

2881099 avatar 2881099 commented on July 4, 2024

https://github.com/2881099/im/blob/master/ImCore/ImServer.cs
看看94行,112行代码

94行是上线,112行是下线

from freeim.

2881099 avatar 2881099 commented on July 4, 2024

你是要告知他们下线了,还是自己下线。

如果自己下线,断开websocket链接即可。

如果告知他们,我下线了,应该用用户状态表示,判断用户是否在线:imcore为上线,并且用户状态是a。当切换为后台运行的时候,把用户状态改为b,当切换进来的时候,把用户状态改为a。改变用户状态就是提交一个webapi接口。

from freeim.

Tim1104 avatar Tim1104 commented on July 4, 2024

我的想法是ImHelper 里面是否可以强制让client 下线。然后就可以触发下线事件

from freeim.

2881099 avatar 2881099 commented on July 4, 2024

我看了一下,ImHelper 如果想实现物理将他人踢下线,其实也是一个 SendMessage 的过程。

如: ImHelper.SendMessage(目标用户, "SYS_DOWN")
ImServer 内处理一下该消息,当收到 SYS_DOWN 消息时,将 socket 关闭。https://github.com/2881099/im/blob/master/ImCore/ImServer.cs 142 行代码

缺点:安全性需要加强,防止任何用户都能发送该消息。

这块代码我就不扩展了,提供上述解决思路,可以下载源码修改尝试。

from freeim.

Tim1104 avatar Tim1104 commented on July 4, 2024

感谢你的回复。我打算用在我的生产应用上面。不知道你有没有用在商业环境上面。是否可以你的微信或者qq 。我的微信 18938792061

from freeim.

2881099 avatar 2881099 commented on July 4, 2024

有,这套用几年,在多个项目上

from freeim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.