Actually use unique client id
This commit is contained in:
parent
b47d2dd2e1
commit
1dcc9ebf66
@ -137,7 +137,7 @@ function love.load()
|
|||||||
local requirePaths = love.filesystem.getRequirePath()
|
local requirePaths = love.filesystem.getRequirePath()
|
||||||
love.filesystem.setRequirePath(requirePaths .. ";client/?.lua;client/?/init.lua")
|
love.filesystem.setRequirePath(requirePaths .. ";client/?.lua;client/?/init.lua")
|
||||||
local mqttThread = love.thread.newThread("mqttthread.lua")
|
local mqttThread = love.thread.newThread("mqttthread.lua")
|
||||||
mqttThread:start()
|
mqttThread:start(love.math.random(0, 999999))
|
||||||
mqttEventChannel = love.thread.getChannel("mqtt_event")
|
mqttEventChannel = love.thread.getChannel("mqtt_event")
|
||||||
mqttCommandChannel = love.thread.getChannel("mqtt_command")
|
mqttCommandChannel = love.thread.getChannel("mqtt_command")
|
||||||
end
|
end
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
local mqtt = require("mqtt")
|
local mqtt = require("mqtt")
|
||||||
local client
|
local client
|
||||||
|
|
||||||
|
local maxClientId = ...
|
||||||
|
|
||||||
local eventChannel = love.thread.getChannel("mqtt_event")
|
local eventChannel = love.thread.getChannel("mqtt_event")
|
||||||
local commandChannel = love.thread.getChannel("mqtt_command")
|
local commandChannel = love.thread.getChannel("mqtt_command")
|
||||||
|
|
||||||
@ -46,7 +48,7 @@ end
|
|||||||
local function main()
|
local function main()
|
||||||
client = mqtt.client {
|
client = mqtt.client {
|
||||||
uri = "mqtt.seeseepuff.be",
|
uri = "mqtt.seeseepuff.be",
|
||||||
username = "mqtt_controller-" .. math.random(0, 999999999),
|
username = "mqtt_controller-" .. math.random(0, maxClientId),
|
||||||
clean = true,
|
clean = true,
|
||||||
reconnect = 5,
|
reconnect = 5,
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user