Paho-mqtt not connecting to server

Hi I am trying to subscribe to the messages/topics with paho-mqtt but which is not connecting to client. here is the snippet of the code.

import time
import sys
import os
from functools import partial

import paho.mqtt.client as mqttClient
# To convert *.txt to *.csv for later use.
# import pandas as pd

from src.node_utils import create_node_logger, connect_to_broker
from src import topics

class LoggingNode():
"""# use to log the details of this two topics
# state_encoders = root + '/' + 'state_encoders'
# format
# Instance of State class
# estimates the robots position based on encoder ticks

# state_model = root + '/' + 'state_model'
# format
# Instance of State class for where the motion model estimates the
# robot will be based on wheel_velocity
#------------------------------------------------------------------# """
    def __init__(self, client, logger):
        self.state = None
        self.logger = logger
        self.client = client

    # initialize subscription to encoders and wheel_velocity
    def on_connect(self, userdata, flags, rc):
        suc1 = self.client.subscribe(topics.state_encoders)
        suc2 = self.client.subscribe(topics.state_model)'Connected and Subscribed: {} {}'.format(suc1, suc2))

    def on_message(self, client, userdata, message):
        print("Message received: "  + message.payload)
        with open('/home/test.txt','a+') as f:
             f.write("Message received: "  + message.payload + "\n")

    Connected = False   #global variable for the state of the connection

if __name__ == '__main__':
    node_name = 'logging_node'
    logger = create_node_logger(node_name)
    client = connect_to_broker()

    node = LoggingNode(client, logger)

    client.on_connect = node.on_connect
    client.message_callback_add(topics.state_model, node.on_message)'Started logging Node loop')

    except KeyboardInterrupt:"KeyboardInterrupt seen")

Here is the state model connected. This is publishing messages as well. Is there anyway I can put subscribe to the data and put that in the *.txt and/or *.csv ?

jay@jay-MS-7885:~/autonomous-class/src$ python3 $HOSTNAME
2020-03-07 19:04:22,412 node:state_estimate INFO 
  Started state_estimate loop

2020-03-07 19:04:22,413 node:state_estimate INFO 
  Connected and Subscribed: (0, 3) (0, 4)