Comments (10)
join 是添加自己。同时有一个 add 方法,相当于你说的 invite。
from js-realtime-sdk.
那为什么roomObj.join向后台sign接口发出的请求,带的action是invite而不是join呢
from js-realtime-sdk.
这个涉及到底层实现,SDK 层面暴露的是一个更加语义化的,包装之后的概念。
底层实现上面并没有对很多事情做封装,所以你会看到很多混在一块的命名和命令,还是以 SDK 层面为准。
from js-realtime-sdk.
这个奇怪的现象将直接影响后端sign的内部实现。
from js-realtime-sdk.
可以说下具体问题,而不是对于这个问题的讨论。
from js-realtime-sdk.
如果roomObj.join向后台sign请求时发送的action是invite,那后端sign接口也就相应的需要用invite相关的接口来处理。在demo中可能大家会将不同action的sign实现放在一个函数里,但是真正写业务的时候,我是分开处理的,比如某些用户是可以join某个group的,某些用户是可以kick用户的。
sign接口,在后端实现里会分发到signJoin、signInvite、signKick等等一系列函数当中。
如果roomObj.join向后台sign请求时发送的action是invite,那signJoin这个函数其实就没有用处了?这样的实现不是很别扭吗。
from js-realtime-sdk.
来个实例,更清楚一些:
function handleGroupActions(client_id, conv_id, member_ids, action, request, response) {
switch(action) {
case 'open':
handleGroupOpen(client_id, conv_id, member_ids, request, response);
break;
case 'kick':
handleGroupKick(client_id, conv_id, member_ids, request, response);
break;
// oops,好像没有任何行为会进入join了
case 'join':
handleGroupJoin(client_id, conv_id, request, response);
break;
// 虽然这里是invite,但是join语义却最终被分发到了invite当中
case 'invite':
handleGroupInvite(client_id, conv_id, member_ids, request, response);
break;
}
}
from js-realtime-sdk.
@liuyanghejerry 这里 invite
和 kick
确实有些迷惑,目前这两个值只是作为常量的名字。join 和 invite 的动作在签名时都是用 invite
作为 action
字段的值。join 只是成员 id 和自己 id 完全相同的特殊 invite
我们的官方文档关于这块的说明有点小问题,我已经发了一个 PR 修改了。
from js-realtime-sdk.
感谢澄清和修正文档,如果方便的话顺便再修正一下文档,文档中 https://leancloud.cn/docs/js_realtime.html#权限和认证 中指向的详情文档实际应为 https://leancloud.cn/docs/realtime_v2.html#权限和认证 ,而不是目前的 https://leancloud.cn/docs/realtime.html#权限和认证
from js-realtime-sdk.
好的,感谢反馈。已修正 wangxiao/leancloud-docs@6e119d8
from js-realtime-sdk.
Related Issues (20)
- 更新 SDK,让美国节点彻底不依赖于注册在国内的域名。 HOT 1
- Typescript导入富媒体消息插件报错 HOT 5
- 处理连接断开后的清理工作时增加状态检查
- IMClient 监听一次‘message’ 回调函数触发三次 HOT 3
- web conversation.read 后 conversation.lastReadAt 不更新,并且 IOS .read 无响应
- CONVERSATION_QUERY_FAILED HOT 7
- 在 queryMessages 时,typescript 报错
- 心跳包 一直报错
- leancloud-realtime-plugin-typed-messages 发下新版? HOT 1
- 对话支持 and 与 or 查询
- 小程序 SDK 引入报错 HOT 2
- Error: App [qQS3pFiLfOx5YGlokrphiKqg-9Nh9j0Va] is aleady initialized. HOT 3
- TypeError: [object Object] is not a Message
- TypeError: [object Object] is not a Message
- 项目运行不了是为什么呢 HOT 3
- PersistentConversation#get 支持深度嵌套的 key HOT 2
- 优化 LiveQuery 订阅失败的处理
- 升级 5.0.0-rc.6 后,项目无法运行 HOT 8
- Warning Using browser-only version of superagent in non-browser environment HOT 10
- 初始化 Realtime 时 plugins 参数可以接受非数组,但类型定义文件中没有包含这种情况
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 js-realtime-sdk.