Issue #1
Go here:
and change the dropdowns at the top of the page to “Defold” and “Lua”
Scroll down to the Rooms section and you will see this code:
local roomname = "MarvelMovieFans"
local persistence = true
local hidden = false
local channel = socket.channel_join(roomname, socket.CHANNELTYPE_ROOM, persistence, hidden)
print("Now connected to channel id: " .. channel.id);
The problem is you will be using the channel.id here to send a chat message later, and this syntax is incorrect. socket.channel_join
returns a table with channel as a nested table inside it, so the correct syntax is:
print("Now connected to channel id: " .. channel.channel.id);
Issue #2
If you specify a roomname, it will not be the channel_id. The actual channel_id that must be used, as discovered by inspecting what socket.channel_join
returns, ends up being something like 2...roomname
. It appears it was not always this way because I found documentation online on github (not Heroic related) where using the roomname
by itself worked as the channel_id, which is much more intuitive. I assume there’s a reason this changed but does anyone know why or where?