简体   繁体   English

可以使用Crossbar.io和WAMP传输文件吗?

[英]Possible to transmit files using Crossbar.io and WAMP?

Is it possible to use WAMP / Crossbar to send small simple files, such as .txt ? 是否可以使用WAMP / Crossbar发送小的简单文件,例如.txt

At the moment, I have this snippet of tutorial code in Python: 目前,我有以下使用Python编写的教程代码片段:

def sendSketch(self, datastring):
    if datastring == "1":
        payload = b'1'

How can I get Python to send out files instead of just a '1'? 我怎样才能让Python发送文件而不是仅发送“ 1”?
This is a pressing need - any help on how to do this would be greatly appreciated. 这是一个迫切的需求-在此方面的任何帮助将不胜感激。

AFAIK it's not possible to send files. AFAIK无法发送文件。 Your code has to get the file, encode it into something which your chosen serialization can handle (eg base64 for JSON), and the receiver then has to decode and create a file from this. 您的代码必须获取文件,将其编码为您选择的序列化可以处理的内容(例如JSON的base64),然后接收者必须从中解码并创建文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM