I have this code running on two different VMs sitting on the same hypervisor: import…
- User
I have this code running on two different VMs sitting on the same hypervisor:
import serial import json from paho.mqtt import client from paho.mqtt.enums import CallbackAPIVersion
The callback for when the client receives a CONNACK response from the server.
def on_connect(client, userdata, flags, reason_code, properties): print(f"Connected with result code {reason_code}") # Subscribing in on_connect() means that if we lose the connection and # reconnect then subscriptions will be renewed. client.subscribe("topic") message = { "type": "status", "source": "gray", "data": "Some String" } mqttc.publish("topic", json.dumps(message), qos=0)
The callback for when a PUBLISH message is received from the server.
def on_message(msg): print(msg.topic+" "+str(msg.payload))
mqttc = client.Client(callback_api_version=CallbackAPIVersion.VERSION2) mqttc.on_connect = on_connect mqttc.on_message = on_message
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.