-1

I have a flask-socketIO application where the breakpoints in my socket.py file are not working.

in __init__.py i have the following code:

from flask import Flask
from flask_socketio import SocketIO
async_mode = None

app = Flask(__name__)
app.config.from_object('config')
socketio = SocketIO(app, async_mode=async_mode)
from .auth import SamlManager
saml_manager = SamlManager()
saml_manager.init_app(app)
from app import views, socket, saml_func
<end> 

socket.py:

from app import socketio

@socketio.on('my_event', namespace='/socket')
def test_message(message):
    emit('my_response', {'data': 'received data'})

if I put a breakpoint anywhere in socket.py, including the imports However, any other code such as views.py, breakpoints are working

views.py:

from app import app, socketio, saml_manager
from flask import render_template

@app.route('/', methods=['GET', 'POST'])
@app.route('/index', methods=['GET', 'POST'])
@saml_manager.login_required
def index():
    return render_template('index.html', async_mode=socketio.async_mode)

Any idea why breakpoints would not be working for socket but would be working for views since I am calling them the same way?

wim
  • 338,267
  • 99
  • 616
  • 750
user1601716
  • 1,893
  • 4
  • 24
  • 53
  • 2
    `socket` is the name of a standard module. You should name your module something else (or call it from a place where there isn't a naming collision). – thebjorn Apr 17 '18 at 16:50

1 Answers1

0

thebjorn got it right in the comments, I had a naming collision so it was never getting to my socket file.

Thanks!

user1601716
  • 1,893
  • 4
  • 24
  • 53