⭐ Hello, 我是 lyouthzzz
ws-gateway's Introduction
ws-gateway's People
ws-gateway's Issues
关于ws-api找ws-gateway的问题
楼主好,你在两篇长连接网关里的描述有一段ws-api找ws-gateway的描述
用户连接
当ws-gateway向ws-api发布连接事件(带上gatewayIP、socketId以及uid),ws-api系统会保存以下几种关联。
关系一:socketId: gateway关联。将socketId与gatewayIP信息保存在redis中,数据结构为String,通过心跳维持key的TTL,一个连接会占用一个redis key。
关系二:uid: socketId关联。存储在redis,一个用户可能会维持多个websocket连接,比如pc的多窗口。数据结构为Set,存储socketId集合。一个用户会占用一个redis key。
根据业务可以衍生出更多的关系,比如群ID、直播间ID等。
但又有下面这个图
第七步写的是广播,我理解根据上面的描述 ws-api已经可以找到要推送的连接在哪一台 ws-gateway上面,直接grpc通知它去推送消息就可以了。
我理解的广播是 比方ws-api给所有的ws-gateway说我要给某个socketId连接推消息,然后所有的ws-gateway自己检查下这个socketId归不归自己管理再去处理
这块感觉有点前后没对上
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.