Spark plug to Mosquitto Broker - Issues

Another update:

Is there a way to use the function node and publish mqtt topics instead of using the MQTT node? I've tried with no luck. I'm using a mosquitto broker, and know how to do it in python, just not node red.