flask-socketio

Flask-Socketio not emitting from external RQ process

时间秒杀一切 提交于 2020-12-13 18:50:46
问题 I'm running a flask server that connects to an iOS client with Flask-Socketio. The server has to process some complicated data, and since that takes a while to solve, I do it in a background job using Redis Queue. Communication works fine normally, but I need to emit to the client, and write to database once the job finishes, and I am trying to do that from the job function (if there is a way to let the app know when the job is finished, the app could handle all communication in one place).

Flask-Socketio not emitting from external RQ process

给你一囗甜甜゛ 提交于 2020-12-13 18:50:29
问题 I'm running a flask server that connects to an iOS client with Flask-Socketio. The server has to process some complicated data, and since that takes a while to solve, I do it in a background job using Redis Queue. Communication works fine normally, but I need to emit to the client, and write to database once the job finishes, and I am trying to do that from the job function (if there is a way to let the app know when the job is finished, the app could handle all communication in one place).

Flask-SocketIO send images

让人想犯罪 __ 提交于 2020-12-10 07:43:58
问题 I am currently working on a project that uses Flask-SocketIO to send things over the internet, but I came across this question. Question: Is there any way to send images in Flask-SocketIO ? I did some googling but no luck for me. 回答1: Socket.IO is a data agnostic protocol, so you can send any kind of information. Both text and binary payloads are supported. If you want to send an image from the server, you can do something like this: with open('my_image_file.jpg', 'rb') as f: image_data = f

Flask-SocketIO send images

纵饮孤独 提交于 2020-12-10 07:42:13
问题 I am currently working on a project that uses Flask-SocketIO to send things over the internet, but I came across this question. Question: Is there any way to send images in Flask-SocketIO ? I did some googling but no luck for me. 回答1: Socket.IO is a data agnostic protocol, so you can send any kind of information. Both text and binary payloads are supported. If you want to send an image from the server, you can do something like this: with open('my_image_file.jpg', 'rb') as f: image_data = f