使用 Web Sockets 进行点对点文件共享 [英] Peer-to-peer file sharing with Web Sockets

查看:26
本文介绍了使用 Web Sockets 进行点对点文件共享的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个理论上的问题,但是,我需要为我的网络套接字驱动的聊天应用程序添加文件共享功能.我可以使用 Amazon S3 之类的服务通过发布文件链接来上传要共享的文件,但这涉及上传可能已经可以通过本地网络访问的文件(例如,在同事之间共享文件).

This is sort of a theoretical question, however, I need to add file sharing capabilities to my web socket powered chat application. I could use a service like Amazon S3 to upload a file to share by posting a link to the file, but that involves the uploading of a file that may already be accessible over the local network (sharing a file between co-workers for example).

所以我有一个想法,即可以通过现有的网络套接字连接以某种方式隧道上传/下载/传输.但是,我对 HTTP 文件传输的了解还不够,无法知道如何实现它的下一步.网络套接字是否有限制以阻止这成为可能?

So I had the idea that it might be possible to somehow tunnel the upload/download/transfer through the already existing web socket connection. However, I don't know enough about HTTP file transfer to know the next step of how to implement it. Is there a limitation to web sockets that would prevent this from being possible?

我正在将 Ruby 和 EventMachine 用于我当前的 Web 套接字实现.如果您能够提供高层次的概述以帮助我入门,那将不胜感激.

I'm using Ruby and EventMachine for my current web socket implementation. If you were able to provide a high level overview to get me started, that would be very much appreciated.

推荐答案

为了允许共享文件而无需将其上传到服务器,(即同事)您现在可以使用 WebRTC DataChannel API,创建对等点对等连接.

To allow files to be shared without the need to upload it to the server, (i.e Coworkers) you can now use the WebRTC DataChannel API, to create a peer to peer connection.

这篇关于使用 Web Sockets 进行点对点文件共享的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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