Skip to content

Commit

Permalink
Create IoT.java
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Jul 25, 2024
1 parent c45813f commit ff58a91
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.sidra;

import org.eclipse.paho.client.mqttv3.MqttClient;
import org.eclipse.paho.client.mqttv3.MqttMessage;

public class IoT {
public static void main(String[] args) {
// Set up an MQTT client
MqttClient client = new MqttClient("tcp://localhost:1883", "client");

// Publish a message
MqttMessage message = new MqttMessage("Hello, world!".getBytes());
client.publish("topic", message);
}
}

0 comments on commit ff58a91

Please sign in to comment.