Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reconstruction PuppeteerMessage Class #724

Closed
binsee opened this issue Aug 11, 2017 · 10 comments
Closed

Reconstruction PuppeteerMessage Class #724

binsee opened this issue Aug 11, 2017 · 10 comments

Comments

@binsee
Copy link

binsee commented Aug 11, 2017

MediaMessage是面向富媒体信息的,包含 图片、语音、视频、文档四大类文件,url类文件也可以算上,但暂时未能实现url类型信息的发出。

new MediaMessage() 来实现实例的初始化,3种调用方式:

  1. 传入接收消息结构体,完全初始化
  2. 传入本地文件地址,默认使用文件名来填充 MsgType.APP 类型信息的必要数据
  3. 无传入参数,创建一个空的MediaMessage实例结构体
    以上初始化过程中默认会初始化 MsgType 参数,用于后续对结构类型的判断

MediaMessage class中,根据不同类型文件/AppMsgType来单独声明一个方法,来追加/更新参数到数据结构中,这样可以更自由一点

另外就是在 ready 方法中,进行必要的数据提取与补充,比如 @ 列表等,

puppet-web 中,对传入的参数对象进行检查,补充必要的参数

bridge 主要做数据中转,不放复杂判断

wechaty-bro 作为和官方代码互交的部分,不直接修改数据。

MediaMessage 和 Message 中,方法分为几类:
初始化与基础数据填充、参数设置、获取参数
数据分为两类:rawObj和obj,所有的初始化与数据填充,都针对rawObj,obj的数据是否可以用getter来实现?

@JasLin
Copy link
Contributor

JasLin commented Aug 11, 2017

@binsee 今天看了你的实现,非常棒.

@zixia 另外一个问题,现在的MediaMessage实际上和PuppetWeb的bridge耦合了,建议把图片、语音、视频、文档等类型的获取放到puppet的接口定义上。

@huan
Copy link
Member

huan commented Aug 12, 2017

@JasLin I fully agree with you.

The current Message implementation can only deal with the WebPuppet. If we consider an AndroidPuppet, then we must move all the web logics from Message to puppet/Message.

@lijiarui
Copy link
Member

lijiarui commented Aug 12, 2017

关于文件大小的整理:

  1. 20M 以下,网页微信和手机微信都可以接受,PC客户端自动下载
  2. 20M--25M,网页微信和手机微信都可以接受,PC客户端不会自动下载,需要点击才能下载
  3. 25M以上,网页微信时而能接受,大部分情况接受不了。在网页上提示下载文件,下载后为0k

@binsee : 看网页的js代码中,有个文件大小限制部分,mp4 的限制是20M 以下,其他类型没有限制,只是有一个25M以上文件会被做个大文件标识。

btw,需要在在这次的更新中加入大文件标识

@binsee
Copy link
Author

binsee commented Aug 12, 2017

官方的实现中,使用512Kb作为chunkSize.

@lijiarui 抱歉,我重新阅读了官方的代码,之前对代码的解读有误。官方web代码并没有对文件有25Mb大小的限制,没有大文件标识这个参数。

但是服务器端对 25Mb 以上的文件进行了限制,不能直接拿来转发。

@huan
Copy link
Member

huan commented Apr 30, 2018

I had refactored the MediaMessage code recently, all I did is to de-couple the code.

Please see #1164 #1167

@huan huan changed the title Reconstruction MediaMessage Reconstruction PuppeteerMessage Class Apr 30, 2018
@huan
Copy link
Member

huan commented May 26, 2018

Hi all, the v0.15 had totally de-coupled the Message from the Puppet implementation details.

Please have a look on puppet if you are interested:

https://github.com/Chatie/wechaty/blob/83891df8a370c5c0edba50b41a5917f7a3dce0c9/src/message.ts#L501-L510

https://github.com/Chatie/wechaty/blob/83891df8a370c5c0edba50b41a5917f7a3dce0c9/src/message.ts#L441-L472

@zhoumh1988
Copy link

不支持AMR文件吗?

@huan
Copy link
Member

huan commented Jul 12, 2018

Closed this issue because PuppeteerMessage is outdated.

Please learn more about the new design by reading the latest source code of Puppet and Message classes.

@huan huan closed this as completed Jul 12, 2018
@huan
Copy link
Member

huan commented Jul 12, 2018

@zhoumh1988 Please file a new issue if you have any question about sending AMR file.

@zhoumh1988
Copy link

@zixia OK,got it.I will try it later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Refactoring
  
Awaiting triage
Development

No branches or pull requests

5 participants