Replies: 1 comment 4 replies
-
I don't have any knowledge of IIS and it isn't a supported web server (or a server I'm interested in adding support for). I doubt IIS is compatible with eventlet, very likely it is not. IIS is also unlikely to have WebSocket support for Python applications. You may get better results dropping eventlet and using the |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi ,
I tried to host a basic example Flask socketIO app on the IIS server using the steps mentioned in the post
https://medium.com/@dpralay07/deploy-a-python-flask-application-in-iis-server-and-run-on-machine-ip-address-ddb81df8edf3
deployment was successful. I was able to browse the default endpoint, but when tried to connect from a c# socketio client application it was just kept on reconnecting, but the same code worked when I run both the applications from visual studio
I referred global environment for my flask application so i don't understand why the client is unable to connect, i tried to log the errors but it did not log anything,
I am new to python, could you please help me as I want to use flask sockets io in my project for implementing API
installed following
sample Flask Server app,
import eventlet
from flask import Flask
from flask_socketio import SocketIO,send,emit
app= Flask(name)
app.config['SECRET_KEY']="mysecret"
socketio= SocketIO(app,cors_allowed_origins="*",async_mode="eventlet")
@app.route('/')
def index():
return "Flask Socket IO server started";
def complex_calculation():
print('Started calculating...')
[x**2 for x in range(20000000)]
@socketio.on_error()
def error_handler(e):
print(e)
@socketio.on("connect")
def connect():
print( "successfully user connected to the server")
@socketio.on('myevent')
def myevent(msg):
print('message from client : '+msg)
complex_calculation()
emit("myevent"," hey client, please this is your response from server",broadcast=False)
if name=='main':
socketio.run(app,host='127.0.0.1',port=5000,log_output=True)
c# client that i have been using to connect
using SocketIOClient;
using System;
using System.Diagnostics;
using System.Text;
using System.Threading.Tasks;
namespace SoketIODotnetClient
{
class Program
{
static DateTime startTime = DateTime.Now;
static async Task Main(string[] args)
{
Console.OutputEncoding = Encoding.UTF8;
Trace.Listeners.Add(new TextWriterTraceListener(Console.Out));
}
Additional info :
did sample using Flask-SocketIO with version 4.3.1, and hosted it on IIS, but it worked fine, was able to connect to the server using c# client.
any changes in a new version that needs any additional configuration while deployment? Please help
Thanks in advance
kthinnal
Beta Was this translation helpful? Give feedback.
All reactions