Comments (10)
断开了后重新连接一次
from freeim.
这个在客户端做?
from freeim.
怎么踢人下线
from freeim.
API端
from freeim.
https://github.com/2881099/im/blob/master/ImCore/ImServer.cs
看看94行,112行代码
94行是上线,112行是下线
from freeim.
你是要告知他们下线了,还是自己下线。
如果自己下线,断开websocket链接即可。
如果告知他们,我下线了,应该用用户状态表示,判断用户是否在线:imcore为上线,并且用户状态是a。当切换为后台运行的时候,把用户状态改为b,当切换进来的时候,把用户状态改为a。改变用户状态就是提交一个webapi接口。
from freeim.
我的想法是ImHelper 里面是否可以强制让client 下线。然后就可以触发下线事件
from freeim.
我看了一下,ImHelper 如果想实现物理将他人踢下线,其实也是一个 SendMessage 的过程。
如: ImHelper.SendMessage(目标用户, "SYS_DOWN")
ImServer 内处理一下该消息,当收到 SYS_DOWN 消息时,将 socket 关闭。https://github.com/2881099/im/blob/master/ImCore/ImServer.cs 142 行代码
缺点:安全性需要加强,防止任何用户都能发送该消息。
这块代码我就不扩展了,提供上述解决思路,可以下载源码修改尝试。
from freeim.
感谢你的回复。我打算用在我的生产应用上面。不知道你有没有用在商业环境上面。是否可以你的微信或者qq 。我的微信 18938792061
from freeim.
有,这套用几年,在多个项目上
from freeim.
Related Issues (20)
- 你好,redis订阅上线能监听到( ImHelper.EventBus),直接关闭网页没有下线通知,能帮忙看看什么原因吗?
- 希望能添加一个踢人下线的功能 HOT 2
- api 端了做了load balance 出现消息重复发送 HOT 1
- 加载index.html的时候报错,好像是连不上websocket
- 现在server 可以负载了,可以加一个单个server 的高可用
- 我在用Imcore做服务器端的时候,app端这边,如果是刚开始运行,能正常连接,但如果在app里面切换账号,然后就要重新换token连接,并且能够连上去,但过一会儿就关闭了。 HOT 2
- 希望能支持视频聊天
- imServer和web业务能否集成在一起呢 HOT 2
- 前端设置心跳检测,30秒后重连token失效 HOT 2
- 我给redis设置密码了,c#代码里面要怎么写? HOT 5
- 服务端出现多条上线、下线通知 HOT 6
- 部署到 centos ,出现错误:【127.0.0.1:6379/0】The operation is not allowed on non-connected sockets HOT 1
- 这个im支持发布在windows server 2016上吗? HOT 4
- 消息回执 HOT 2
- 在https方式下收不到消息 HOT 2
- 视频通话如何接入? HOT 2
- 作为游戏大厅服务器可行吗? HOT 1
- 关于WSS的配置问题 HOT 9
- 我真有点搞不懂 HOT 14
- 查了资料如果不指定端口,这里默认显示5000,原来是MS搞的
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from freeim.