嘿!。实际上,我使用python语言通过以下模块autobahn,twisted连接到我的googlecloudvm实例。我的googlecloudvm实例可以完美地接收和发送图像到python客户机文件。在
但是,当我们在flutter上开发Android/IOS应用程序时,我需要从dart调用python代码,以便从flutter应用程序调用python函数。但我找不到任何方法来做这件事。
这是我的客户端代码,它将连接到部署在vm实例上的服务器。在from autobahn.twisted.websocket import WebSocketClientProtocol, \
WebSocketClientFactory
import main
import jsonpickle
import base64
import matplotlib.pyplot as plt
import time
class MyClientProtocol(WebSocketClientProtocol):
def onConnect(self, response):
print("Server connected: {0}".format(response.peer))
def onOpen(self):
print("WebSocket connection open.")
def hello():
# opening the image file and encoding in base64
path = "/home/abdullah/Desktop/Clocktower_Panorama_20080622_20mb.jpg"
image =