将大型(和二进制)文件上传到Worklight适配器 [英] Uploading large (and binary) files to Worklight adapter

查看:277
本文介绍了将大型(和二进制)文件上传到Worklight适配器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用Worklight在混合应用程序上使用大型图像和长音频文件进行大量工作。我看到我可以调整适配器调用的最大文件设置,但我没有看到一个有效的方法来有效地做一个大文件的帖子。

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.

为了增加更多的复杂性,我看到Cordova文件工具不支持跨所有本地操作系统的二进制流(如音频数据)。

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.

推荐答案

首先,让我说这应该被视为Worklight团队的功能请求。我们的解决方案并不理想。

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

使用JMS可能是我看到的最佳解决方案。但是,我们现在不能在我们的实现中使用JMS,所以我不得不做别的事情。

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.

我们使用Cordova fileUpload API解决了这个问题,并通过后端的SSL与自定义构建监听器进行通信。我们调用适配器以获得共享密钥和通信的秘密端口号。然后,我们使用Cordova API对该端口号进行SSL调用,使用指定的键,连接在传输后关闭。

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.

这篇关于将大型(和二进制)文件上传到Worklight适配器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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