Nakama realtime chat documentation seems out of sync with latest changes

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?

Hello @ChrisYoo,

Thank you for the feedback on Issue #1 (cc @HeroicNathan please correct the docs when possible).

On Issue #2, as far as I’m aware, it’s always been the case that you need to a channel_id returned by channel_join even for rooms. If you’ve found documentation that states otherwise it’s likely incorrect.

Best.

1 Like

Further down on the same page as the original post there is this:


Which uses “channel_id” defined earlier, not using the result of socket messages, which can add prefixes to the channel_id.

I’m not sure honestly if it’s the defold-nakama wrapper messing this part up by altering the channel id or not. I’m a newbie to all this.