在发送大尺寸图像,视频和音频时断开XMPP客户端 [英] Disconnection of XMPP client while sending big size image, video and audio

查看:283
本文介绍了在发送大尺寸图像,视频和音频时断开XMPP客户端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用robbiehanson xmpp示例实现了xmpp。我能聊天,也能发送图像。我发送的图像转换为nsdata并进一步转换为Base64String,然后发送字符串

I have implemented xmpp using robbiehanson xmpp example. I am able to chat and also able to send images. The images which i am sending are converted to nsdata and further converted to Base64String, and later sending the string with

[self.xmppStream sendElement:message ];

这样,如果图像尺寸很小,我可以立即发送,但如果图像的大小更大,那么两个xmpp用户断开连接,文件未传输。视频和音频也是如此。虽然我能够使用

This way if the size of image is small i am able to send that instantly but if the size of images is bigger the two xmpp user gets disconnected and the file is not transferred. Same thing happens with video and audio. Though i am able to compress the images using

UIImageJPEGRepresentation(image,0.005);

但是如何发送视频和音频的大小显然会很大。我已阅读XEP - 0065和XEP - 0096上的文档,但无法以正确的方式实现它。请让我知道为什么用户断开连接,为什么我无法使用base64传输繁重的文件,并且还共享可以帮助我传输视频和音频的代码。

But how to send the video and audio as the size would obviously be big. I have read documents on XEP - 0065 and XEP - 0096 but not able to implement it in a proper way. Please let me know why do the users gets disconnected, why i am not able to transfer heavy files using base64 and also share the code which would help me to transfer video and audio.

真的很感谢你的帮助。

推荐答案

虽然XMPP允许传输少量二进制数据,但建议分享大量文件或视频/音频流带外并使用XMPP作为信令协议 - 你应该只是发送http://或rtp://链接,您的好友的客户端将下载它,或开始播放给定流的音频/视频。您可以以任何形式发送该链接,但有一些草案标准XMPP扩展,允许与现有客户兼容:

While XMPP allow to transfer small amount of binary data, it is recommended to share large files or video/audio streams "out of band" and use XMPP as signaling protocol - you should just send http:// or rtp:// link, and your buddy's client will download it, or start playing audio/video from given stream. You can send that link in any form, but there are some "draft standard" XMPP extensions, which allow to get compatibility with existing clients:


  1. XEP-0066:带外数据 - 简单的扩展,您只需将URL附加到标准< message /> 元素。

  2. XEP-0095:流启动 XEP-0166:Jingle - 这些是元规范,描述客户是如何协商他们支持的功能,选择分享他们喜欢的数据的方式( ibb oob 字节流 jingle rtp 等),找到打开的TCP端口或调解代理,NAT遍历等。

  1. XEP-0066: Out Of Band Data - simple extension, where you just attach URL to standard <message /> element.
  2. XEP-0095: Stream Initiation and XEP-0166: Jingle - these are "meta"-specifications, describing how clients are "negotiate" their supported features, selects which way to share data their prefer (ibb, oob, bytestreams, jingle rtp, etc.), finds opened TCP ports or mediating proxies, NAT traversal, etc.

所以,如果你只是想共享文件 - 通过任何现有的文件共享服务共享它,并按照第一个XEP中的描述发送URL。如果您想构建大型服务或VOIP应用程序 - 请使用SI或Jingle。但没有人阻止你创建自己的XMPP扩展,这可能更容易实现。 此处是一个自定义XMPP扩展,不是由XMPP社区开发,而是由XSF接受作为实验,您也可以检查它。

So, if you just want to share file - share it via any existing file sharing service and send URL as described in the first XEP. If you want to build large service or VOIP application - use SI or Jingle. But no one stop you to create your own XMPP extension, which may be simpler to implement. Here is a custom XMPP extension, which was developed not by XMPP community, but accepted by XSF as experimental, you can check it too.

这篇关于在发送大尺寸图像,视频和音频时断开XMPP客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆