Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
685 views
in Technique[技术] by (71.8m points)

cordova - Uploading large (and binary) files to Worklight adapter

We're doing a lot of work with large images and long audio files on hybrid apps using Worklight. I see that I can adjust the max file setting for calls to the adapter, but I don't see a good way to effectively do something like a post of a large file.

To add further complexity, I'm seeing that the Cordova File tools don't enable working with binary streams (such as audio data) across all native operating systems.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

First, let me say that this should be considered as a feature request for the Worklight team. Our solution is not ideal.

Using JMS is probably the best solution I see. However, we're not able to use JMS in our implementation right now, so I had to do something else.

We solved this by using Cordova fileUpload APIs and communicating to a custom build listener via SSL on the backend. We make a call to an adapter to get a shared secret key and a secret port number for the communications. We then using the Cordova APIs to make an SSL call to that port number, with the specified key and the connection closes after the transfer.

I'm concerned about large scale performance of this process and unintended security holes, but so far it's working for our purposes. Hopefully soon, there will be a better way to make large file transfers to the adapter.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...