Flask and Flask-SocketIO
<p>This seems like a very simple problem but it's got me confused nonetheless, I have a Flask application that serves up a webpage and communicates with that page via Socket.io. The Flask application looks like this:</p>

<pre><code>app = Flask(__name__)
socketio = SocketIO(app)

@socketio.on_error()
def error_handler(e):
    print e

#this fires
@socketio.on("connect")
def connect():
    print "connected"

#this does not    
@socketio.on('test')
def test_handler(message):
    print "TEST WORKS"

if __name__ == "__main__":
    app.run(debug=True, host='0.0.0.0')
    socketio.run(app)
</code></pre>

<p>My page itself is very simple:</p>

<pre><code>&lt;!doctype html&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;Flask Socket.IO test&lt;/title&gt;
    &lt;style&gt;
      body { font: 13px Helvetica, Arial; }
    &lt;/style&gt;

    &lt;script src="socket.io-1.4.3.js"&gt;&lt;/script&gt;
    &lt;script src="jquery-2.2.0.min.js"&gt;&lt;/script&gt;
    &lt;script&gt;
      var socket = io("192.168.42.1:5000");
        socket.on('connect', function() {
            console.log(" connected ");
        });
        $(document).ready( function() {
            $( '.startBtn' ).click(function() {
                console.log("ok");
                socket.emit('test', {data:"start!"});
            });
        });
    &lt;/script&gt;

  &lt;/head&gt;

  &lt;body&gt;
    &lt;div class="startBtn"&gt;
        &lt;h1&gt;START&lt;/h1&gt;
    &lt;/div&gt;
  &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>I see on both sides that they connect (i.e. the connect event is triggered on both sides) but nothing that I send from the page to the server is received. I'm guessing somehow I have things misconfigured but the connection being established makes me think otherwise. </p>