Complete example of Strophe.js file transfer [closed]

℡╲_俬逩灬. 提交于 2019-11-27 04:32:43

问题


I'm developing a chat web client (XMPP based) using Strophe.js. On server side I have an Openfire server.

I'm looking for a complete (and working) example of file transfer (xep-0096) using Strophe.js.

I know there is a plugin, named si-filetransfer, which should help in implementing this feature but documentation is missing. So it is not easy to understand how it works.

Here on StackOverflow I found only some incomplete post relating the matter, as for example: Save received files from xmpp Strophe si-filetransfer

Also on the web I didn't find any complete solution to my needs.

If there is another solution to achieve the above goal (file transfer in a JS client using XMPP protocol) it 's welcome!


回答1:


Here below is a very simple chat demo written using jQuery and StropheJS with file transfer features. Implementation of file transfer is based on these two Strophe.js plugins:

  • https://github.com/strophe/strophejs-plugins/tree/master/si-filetransfer: it allows to send and receive stream initiations

  • https://github.com/strophe/strophejs-plugins/tree/master/ibb. it provides a transport mechanism (In-Band Bytestream)

In addition, in order to allow the transfer of files greater than 65535 bytes it is also used a chunking algorithm.

Here is the Plunker: http://plnkr.co/edit/fYpXo1mFRWPxrLlgr123

P.S.: you have to deploy your own XMPP server and adapt the following code lines according to your configuration:

var server = 'mydomain.com';
var BOSH_SERVICE = 'http://127.0.0.1:7070/http-bind/';


来源:https://stackoverflow.com/questions/35292181/complete-example-of-strophe-js-file-transfer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!