Comments (10)
是否设置了快应用的 Adapters ?
from js-realtime-sdk.
是否设置了快应用的 Adapters ?
有设置的,初始化登录都没有问题,发消息就报出这个问题了,猜测是new Textmesage 的时候发生的
from js-realtime-sdk.
可以贴一下导入 SDK 的代码吗。
from js-realtime-sdk.
https://rpk.quickapp.cn/s/28f10ab392d5e46719f6252a8e87d258
你可以通过这个链接打开这个快应用sample,基本按照官网文档,就是跑不起来的
from js-realtime-sdk.
Warning Using browser-only version of superagent in non-browser environment
这个错误的原因是设置了浏览器使用的 adapters 。我导入了你分享的代码,因为没有真机,就用开发工具本地测试了一下,没有复现上述问题。
我觉得也有可能是开发工具的问题,可以重新安装依赖试一试。
from js-realtime-sdk.
因为开发工具里面的预览是浏览器环境,和真机差异还有较大不同,所以应该以真机的表现为准,这个警告就是真机抛出来的,你可以看app.ux里的代码,就是完全按照官网文档写的,甚至连window这种对象的都有问题,在看了adapters快应用的代码和realtime的代码,我发现两点问题:
1、adapters没有看到对window对象的模拟;
2、realtime的引用目录里也没有针对快应用的js,但是有node和小程序的。
所以我理解应该是没有完全适配快应用,不知道对不对?
from js-realtime-sdk.
-
没有对 window 对象的模拟是因为快应用 Adapters 不是提供一个兼容 HTML5 的环境,而是将快应用独有的接口包装成统一的接口。
-
Node 作为常用平台提供单独的入口,不需要设置 Adapters 。微信小程序的入口文件是 Adapters 机制出现之前的产物。为解决需要为不同平台提供独立的入口文件的问题才创建了 Adapters 机制。
from js-realtime-sdk.
那辛苦再看下吧,按照官网文档,即时通讯的SDK在快应用中确实跑不起来。
from js-realtime-sdk.
我用云测申请了一台远程主机试了下,发现问题出在 leancloud-realtime-plugin-typed-messages
这个包。把 require 这个包的代码删掉,从 leancloud-realtime/im
中引入 TextMessage
就可以在真机上正常发送文本消息了。
我后续会解决下富媒体消息插件的跨平台兼容性。
from js-realtime-sdk.
好的,感谢~
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
- 初始化 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.