title: Flask socket(server-side) is not connecting with client-side (Javascript)
body: <p><a href="https://i.stack.imgur.com/pmTOn.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pmTOn.jpg" alt="File-Strucure" /></a></p>
  <p>The client-side isn't connecting with the server-side.</p>
  <p>THE SERVER-SIDE CODE:</p>
  <pre><code>from flask import Blueprint, render_template
  from hook.routes.auth import login_required
  # from flask_socketio import emit, join_room, leave_room
  from .. import socketio
  
  chat = Blueprint('chat', __name__)
  
  @chat.route('/')
  @login_required
  def index():
      &quot;&quot;&quot; chat page if user is logged in &quot;&quot;&quot;
      return render_template('main/chat.html')
  
  
  @socketio.on('connecting', namespace='/chat')
  def connected(data):
      print(&quot;&quot;&quot;
  
          connecting server-side...
          
          &quot;&quot;&quot;)
      print(data)
  </code></pre>
  <p>THE CLIENT-SIDE CODEconsole.log(&quot;Javascript (chat-script) connected.&quot;)</p>
  <pre><code>document.addEventListener('DOMContentLoaded', () =&gt; {
      // Connect to Websocket
      var socket = io.connect(location.protocol + '//' + document.domain + ':' + location.port + '/chat');
      console.log(&quot;Starting sockets! &quot; + location.protocol + '//' + document.domain + ':' + location.port + '/chat')
      // When connected
      socket.on('connect', () =&gt; {
          console.log(&quot;Connecting script...&quot;);
          socket.emit('connecting', {'data': 'I\'m connected!'});
      })
  });
  </code></pre>
  <p>No errors but the server-side is not receiving the data from the client-side.</p>