Last active
June 20, 2024 13:36
Revisions
-
revant revised this gist
Jun 20, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ const mqtt = require("mqtt"); const client = mqtt.connect("mqtt://event-bus:1883", { clientId: require('crypto').randomUUID(), clean: true, connectTimeout: 4000, username: 'emqx', -
revant revised this gist
Jun 18, 2024 . 2 changed files with 15 additions and 0 deletions.There are no files selected for viewing
File renamed without changes.This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ const net = require('net'); const server = net .createServer(socket => { socket.on('data', data => { console.log(data.toString()); }); }) .on('error', err => { throw err; }); server.listen(8000, '0.0.0.0', undefined, () => { console.log('TCP server is listening on 0.0.0.0:8000'); }); -
revant created this gist
Jun 13, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ const mqtt = require("mqtt"); const client = mqtt.connect("mqtt://event-bus:1883", { clientId: "clientId", clean: true, connectTimeout: 4000, username: 'emqx', password: 'public', reconnectPeriod: 1000, }); client.on('connect', () => { console.log('Connected'); client.subscribe("+", () => { client.on('message', (topic, message) => { console.log(`Received message "${message.toString()}" on topic "${topic}"`) }) }); })