go-socket.io
go-socket.io copied to clipboard
How to set CORS?
Hello. I could archive CORS rule in python like this.
app = Flask(__name__)
origins = ["https://example.com", "https://www.example.com"]
cors = CORS(app, resources={r"/*": {"origins": origins}})
app.config['SECRET_KEY'] = 'secret!'
socketio = SocketIO(app, async_mode="threading", cors_allowed_origins=origins)
socketio.run(app, debug=False, allow_unsafe_werkzeug=True)
Is there an equivalent code in go-socket.io? This may sound dumb as I am new to go lang and go-socket.io. Thank you!
@jvstatinydev Hey! is it code doesn't help to you?
@sshaplygin Hello! Thank you for the example code. Could you let me know how to set CORS with this example? I want to allow one domain like I did in the python example that I wrote. I guess I should do something in "allowOriginFunc"?