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

XEP-0363: HTTP File Upload #161

Closed
ghost opened this issue May 23, 2014 · 32 comments

Comments

@ghost
Copy link

commented May 23, 2014

Hello.

It probably hasn't been implemented from what I've seen, but is there/could there be a way of handling file upload/transfer from within the chat?

For example, I'd like to select (or drag and drop) a file from my drive in a conversation (either room or private). At that point, probably Converse.js would not handle the file itself, but rather offer a hook when such an event occurs. I have no experience with such events actually.
In the end, once the upload is considered over, an URL would be sent as a message, so chat users can access the file right away.

Thanks in advance.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@ghost

This comment has been minimized.

Copy link
Author

commented May 23, 2014

A possibility would be, using WebRTC, to pass sending/receiving information through the chat.
Don't know yet how to do that. I'll look into it if that's worth it.

@jcbrand

This comment has been minimized.

Copy link
Member

commented May 26, 2014

File transfers would be a useful feature.

There is an XEP (0096) for this: http://xmpp.org/extensions/xep-0096.html

And there is also a Strophe.js plugin: https://github.com/strophe/strophejs-plugins/tree/master/si-filetransfer.

I agree that WebRTC could be used to transfer the file data out-of-band while XMPP is used to initialize the transfer.

@jcbrand jcbrand added the enhancement label May 26, 2014

@ghost

This comment has been minimized.

Copy link
Author

commented Mar 2, 2015

Hello,

What about Jingle File Transfer: http://xmpp.org/extensions/xep-0234.html?

Conversations, gajim and swift implement that.

Thank you.

@jcbrand

This comment has been minimized.

Copy link
Member

commented Mar 3, 2015

@kruks23 Thanks for the info. I haven't yet decided upon a standard, but good to know that XEP-0234 is implemented by those projects.

@chihanlin

This comment has been minimized.

Copy link

commented Mar 9, 2015

There are some WebRTC js available. For example, jsSIP, SIP.js, if converse.js can aware any one of these two, converse.js + (jsSIP or SIP.js) could be a great "Web based" UC client. those js do support file transfer, plus video, voice support, they connect to the sip based IP-PBX. It will be a powerful integration client.

@chihanlin

This comment has been minimized.

Copy link

commented Jan 20, 2016

The file transfer probably can use http post... if it make sense... The user can upload the file, and the http server reply back the file URL to the sender when the file upload successfully , and the file sender then send out the URL to received side by using xmpp message. When the Received side get the message, the received side can show the URL and allow the user to click the URL to download the file from the http server. It is quite simple in this way.

@ghost

This comment has been minimized.

Copy link
Author

commented Jan 23, 2016

I think now is better to use Http File Upload (#466).

@nodiscc

This comment has been minimized.

Copy link

commented Jan 23, 2016

Note that this requires a third-party file storage service:

The actual upload of the file happens via HTTP-PUT and is out of scope of this document

Whereas https://xmpp.org/extensions/xep-0096.html requires no additional server (if I understand correctly)

@ghost

This comment has been minimized.

Copy link
Author

commented Jan 24, 2016

Http FIle Upload requires the same server that you use to send your messages via xmpp. Servers like ejabberd or prosody already support xep-0363 Http file upload.
it is something like xep-0313 Message archive management, messages are stored in the xmpp server.

@devurandom

This comment has been minimized.

Copy link

commented Feb 16, 2016

I created #593 for XEP-0234 (Jingle File Transfer) support. Could this issue please be renamed to "XEP-0363 - HTTP File Upload" (and add a link to XEP-0363 to clarify the destinction?

@nodiscc I think many clients are migrating away from XEP-0096 (SI File Transfer) and new clients are not implementing it, but are rather going straight for XEP-0234. The reason is afaik that XEP-0095 (Stream Initiation), on which SI File Transfer is based, does not deal with firewalls and NAT. This is handled by XEP-0166 (Jingle), on which Jingle File Transfer is based. Details can be found in the Requirements section of the Jingle File Transfer specification.

@jcbrand jcbrand changed the title File transfer HTTP file upload Feb 16, 2016

@jkufner

This comment has been minimized.

Copy link

commented Apr 18, 2016

HTTP storage is provided by Jabber server (ejabberd and prosody provides this). So to implement this feature, two tasks to be done: 1. Negotiate upload slot via XMPP, 2. perform HTTP PUT on the negotiated URL. That's it. Once upload is completed, URL needs to be sent via chat, but that is an ordinary message. To receive the uploaded file, nothing has to be done, the URL will appear in chat and that is completely fine.

HTTP upload is the most reliable file sharing method Jabber has. There is no need to implement anything else, since nothing else is actually supported widely enough and even when it is supported clients must understand each other (XEP versions) and must be able to connect to each other (NAT, firewall). It never really worked for me. On the other side, HTTP upload works well in MUC and with transports (ICQ, Facebook), since the only thing to send via chat is plain URL.

@devurandom

This comment has been minimized.

Copy link

commented Apr 19, 2016

HTTP storage is provided by Jabber server [...]
There is no need to implement anything else, since nothing else is actually supported widely enough [...]

In my experience, XMPP servers (instances, not the software) which support modern XEPs are extremely rare. So rare in fact, that I am again running an own instance, because none of the available (free or part of a paid email contract) ones support any useful (mobile) extensions. Many people will probably not be in the lucky situation that they can easily boot up an own XMPP server.

Thus I would argue that a file transfer implementation which is independent of the server is still very much needed.

@jkufner

This comment has been minimized.

Copy link

commented Apr 19, 2016

@devurandom As I understand purpose of Converse.js, it is meant for integration into another application, therefore you run your own infrastructure more or less anyway.

@jcbrand jcbrand changed the title HTTP file upload XEP-0363: HTTP File Upload Nov 14, 2016

@tbeitter

This comment has been minimized.

Copy link

commented Jul 27, 2017

I'd love to see http_upload here, too. +1

@devurandom

This comment has been minimized.

Copy link

commented Dec 17, 2017

This would likely also need support XEP-0370 to integrate nicely with other clients. I created issue #966 to track implementation of that XEP.

@happy-dev

This comment has been minimized.

Copy link
Contributor

commented Dec 31, 2017

@jcbrand : Would you set me on track for this ? :)
I could give it a try

@jcbrand

This comment has been minimized.

Copy link
Member

commented Jan 5, 2018

@happy-dev You'll need to write a plugin for converse.js

The most up to date docs for plugin development are here:
https://github.com/jcbrand/converse.js/blob/master/docs/source/plugin_development.rst

Once the next release is made, those docs will also be on https://conversejs.org

@happy-dev

This comment has been minimized.

Copy link
Contributor

commented Jan 5, 2018

Thank you very much !
I share this with the rest of the team and get back to you

@happy-dev

This comment has been minimized.

Copy link
Contributor

commented Jan 5, 2018

Team OK for it.
My idea of the implementation would be :

  • configure some cloud storage solution
  • upload the file to it
  • post back a link on the chat when the file is done uploading on the cloud storage

Would you have any recommendation to tackle this ?
Do you believe this is an acceptable way to handle the feature ?
Is there any existing function or XEP I should take into account before getting started ?

Many thanks for your inputs

@jcbrand

This comment has been minimized.

Copy link
Member

commented Jan 5, 2018

@happy-dev Sounds great :)

Generally how I go about adding new features/plugins, is that I first write the plugin outline, and make sure it's loaded together with all the other plugins.

That requires a few steps, such as updating the src/config.js file, adding the file to the src directory and whitelisting it in converse-core.

Most of that is covered in the plugin documentation mentioned above. The only thing not mentioned that I can think of now is the fact that you also need to set the plugin path in src/config.js.

Then, once you have the plugin registered and loading when you load converse.js, you can start adding the functionality via test-driven development.

I don't always do test-driven development, or let's say at least, I don't always start with tests. But with the XMPP protocol it works well because you can directly test the XML stanzas from a relevant XEP and then check that converse.js does the right thing.

So, once the plugin outline is available, I'd study the relevant XEP-0363 and start mocking the XML traffic in tests. I'd create a new test file in the spec directory, to specifically test this new plugin.

This is fairly easy to do. Take a look at spec/protocol.js for tests which test the XMPP protocol. Similar things are done in spec/chatbox.js and spec/chatroom.js.

Basically you can simulate incoming XML stanzas, write your plugin to send the right outgoing stanzas and then test that this all conforms to the XEP.

This way you can write a plugin without needing an XMPP server at all. At least initially, obviously later you'll want to test with a real server.

@happy-dev

This comment has been minimized.

Copy link
Contributor

commented Jan 5, 2018

Thank you so much. I believe you just set the TODO list for this weekend !
See you on Monday ;)

@happy-dev

This comment has been minimized.

Copy link
Contributor

commented Jan 5, 2018

Sounds excellent. I am coming.

Which XMPP client do you recommend on Linux (if you use Linux of course) ?

@jcbrand

This comment has been minimized.

Copy link
Member

commented Jan 5, 2018

Gajim is pretty good. I'd recommend that.

I personally use converse.js inside the browser :)

In the repo I run make serve and then I open https://localhost:8000/inverse.html (of a modified version of that file for dev purposes).

@happy-dev

This comment has been minimized.

Copy link
Contributor

commented Jan 6, 2018

Then GO converseJS
I actually wanted to know if you used something else.
Converse is more than fine with me

@jcbrand jcbrand added the in progress label Apr 6, 2018

@jcbrand jcbrand added this to the 4.0.0 milestone Apr 6, 2018

jcbrand added a commit that referenced this issue Apr 17, 2018

Updated and refactored the work from @worlword
* Use Promises instead of callbacks
* Update to latest (Last Call) version of XEP-0363
* Move non-view specific methods to models instead
* Add more tests

updates #161

jcbrand added a commit that referenced this issue Apr 17, 2018

jcbrand added a commit that referenced this issue Apr 17, 2018

jcbrand added a commit that referenced this issue Apr 17, 2018

jcbrand added a commit that referenced this issue Apr 17, 2018

Remove separate file `converse-http-file-upload`
It contained only `overrides` and some HTTP upload code was in other
modules.

Current thinking concerning overrides:

Usage of `overrides`, while useful in certain cases, should in general
be discouraged, since it's in essence "monkey patching" which makes it
more difficult to know whats executing at runtime and more difficult to
refactor.

Splitting modules up between XEPs is not always that useful. Some XEPs,
like HTTP Upload (and MAM comes to mind) have their functionality spread
out over single and group chats (and pubsub) and might for practical
purposes be considered "core" enough to not try and keep them in
separate modules (which inevitably requires overrides or a fundamentally
rethinking the architecture).

Where splitting code between modules makes a lot of sense is in keeping
Backbone Models and Views separate (so that alternative view libraries
like Vue could be used) and probably in keeping Single chats, MUC,
PubSub and MIX separate.

updates #161

jcbrand added a commit that referenced this issue Apr 17, 2018

Move methods from chatbox view to message view
Specifically the methods related to requesting an upload slot and uploading a file.
Also show a progress indicator while a file is being uploaded.

Updates #161

jcbrand added a commit that referenced this issue Apr 18, 2018

jcbrand added a commit that referenced this issue Apr 18, 2018

jcbrand added a commit that referenced this issue Apr 18, 2018

jcbrand added a commit that referenced this issue Apr 22, 2018

jcbrand added a commit that referenced this issue Apr 22, 2018

@jcbrand

This comment has been minimized.

Copy link
Member

commented Apr 22, 2018

This has been implemented and will be included in the 4.0.0 release.

@jcbrand jcbrand closed this Apr 22, 2018

jcbrand added a commit that referenced this issue Apr 24, 2018

updates #161
* Fix typo which broke MUC file upload
* Remove unused method
* Move file input into li element

jcbrand added a commit that referenced this issue Apr 24, 2018

@Heraptor

This comment has been minimized.

Copy link

commented Sep 29, 2018

Would like anyone to show how to configure converse.js to enable "File sharing / HTTP File Upload XEP 363" function ?

@jcbrand

This comment has been minimized.

Copy link
Member

commented Sep 30, 2018

@Heraptor you need to make sure your xmpp server supports that XEP.

@Pankhur

This comment has been minimized.

Copy link

commented Nov 28, 2018

@jcbrand i have setup ejaabberd & converse.js and everything is working fine as far as chat is concerned. Now please guide me the way for attachment support in the same. Thanks

@licaon-kter

This comment has been minimized.

Copy link
Contributor

commented Nov 28, 2018

@Pankhur What error do you see?

@Pankhur

This comment has been minimized.

Copy link

commented Nov 28, 2018

@licaon-kter So, i configured ejabberd.yml config for attachment support as mentioned here

https://stackoverflow.com/questions/35578600/mod-http-upload-http-file-upload-xep-0363-using-ruby-on-rails

but nothing seems to working and when i attach any file via converse it just sits idle there.

@licaon-kter

This comment has been minimized.

Copy link
Contributor

commented Nov 28, 2018

So, error in browser console? Error in ejabberd.log? Actual config of server?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
10 participants
You can’t perform that action at this time.