WEBIM如何处理接收的文件消息?
已知DEMO中是这么处理文件消息的
//处理收到文件消息可是这个是接收即下载,我想先得到下载链接,自行决定是否下载
var handleFileMessage = function(message) {
var filename = message.filename;
var filetype = message.filetype;
var from = message.from;
var mestype = message.type;//消息发送的类型是群组消息还是个人消息
var contactDivId = from;
if (mestype == 'groupchat') {
contactDivId = groupFlagMark + message.to;
}
var options = message;
options.onFileDownloadComplete = function(response, xhr) {
var spans = "收到文件消息:" + filename;
appendMsg(from, contactDivId, spans);
return;
};
options.onFileDownloadError = function(e) {
appendMsg(from, contactDivId, e.msg + ",下载文件" + filename + "失败");
};
Easemob.im.Helper.download(options);
};
没有找到相关结果
已邀请:
1 个回复
lizg - ……