关于颤振和Python之间的局部连接

关于颤振和Python之间的局部连接,python,flutter,Python,Flutter,我想用Python后端连接flatter。一些教程,如或建议使用FLASK的REST-API连接Flatter和Python 通常,使用FLASK创建本地主机,Flatter应用程序通过http包获取信息 我需要创建一个flatterpython连接,这是非常安全和本地的,这意味着当应用程序发布时,python函数可能不会在服务器上工作,而是在手机上工作 有没有可能实现在手机上运行颤振前端初始化烧瓶后端的过程?我做了一些研究,找到了一个答案,希望能为您指明正确的方向。解决方案看起来很相似。让我知

我想用Python后端连接flatter。一些教程,如或建议使用FLASK的REST-API连接Flatter和Python

通常,使用FLASK创建本地主机,Flatter应用程序通过http包获取信息

我需要创建一个flatterpython连接,这是非常安全和本地的,这意味着当应用程序发布时,python函数可能不会在服务器上工作,而是在手机上工作


有没有可能实现在手机上运行颤振前端初始化烧瓶后端的过程?

我做了一些研究,找到了一个答案,希望能为您指明正确的方向。解决方案看起来很相似。让我知道

因此,在本例中,您必须在创建套接字实例时添加'transports':['websocket']

IO.Socket socket = IO.io('http://localhost:3000', <String, dynamic>{
    'transports': ['websocket'],
    'extraHeaders': {'foo': 'bar'} // optional
});
The default Flask development server doesn't support websockets so you'll need to use another server. Thankfully it's simple to get eventlet working with Flask. All you should have to do is install the eventlet package using pip.

我做了一些研究,找到了一个答案,希望能为你指明正确的方向。解决方案看起来很相似。让我知道

因此,在本例中,您必须在创建套接字实例时添加'transports':['websocket']

IO.Socket socket = IO.io('http://localhost:3000', <String, dynamic>{
    'transports': ['websocket'],
    'extraHeaders': {'foo': 'bar'} // optional
});
The default Flask development server doesn't support websockets so you'll need to use another server. Thankfully it's simple to get eventlet working with Flask. All you should have to do is install the eventlet package using pip.

You can use chrome to double check what transport method is being used. Open your chrome dev tools Ctrl+Shift+I in Windows and go to the Network tab. On each network request you should see either transport=polling or transport=websocket