79336414

Date: 2025-01-07 15:00:07
Score: 0.5
Natty:
Report link

The problem originated from the way the sockets are configured in the python files, as the different namespaces used for the project were not specified on each socket.on(...) or emit(...) method.

Python files after fix:

# Example from main.py file
socketio.on_event('getter', jobs.getter, namespace='/jobs')

# Example from jobs.py file
emit('error', json.dumps({"status_code": r.status_code}), namespace='/jobs')

I also specified the namespaces on the Angular files as such:

// class used to handle the sockets of the '/jobs' namespace
export class SocketJobs extends Socket {
  constructor() {
    super({ url: socketio_url + '/jobs', options: { autoConnect: false } });
  }
}

// more code //

this.socket.emit('getter', {
          // json //
        });
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: asnyp