Skip to content

SendWebSurfaceMessage

Sends every copy of a surface’s page a message - a table, a text, a number or a boolean.

Every player who has the surface now (it is near them and their game runs a web layer) gets the message; their copy’s KcdMp.onMessage receives exactly the value sent. A copy still loading keeps it until it is ready; a player whose copy is closed gets nothing - their next OnPlayerWebSurfaceReady is when to send it again. data is written as JSON by JsonEncode, 60000 bytes at most. The answer is true, or false and the reason: "no such surface", "no data", "too big", "reserved key" (a __kcdmp key at the top) or what JsonEncode says.

SendWebSurfaceMessage(id, data)
Parameter Type
id number the surface
data table | string | number | boolean the value the pages receive

true, or false, reason

table.insert(notices, { title = "Market day", text = "Thursday, by the well." })
SendWebSurfaceMessage(board, { notices = notices })

SendPlayerWebSurfaceMessage · OnPlayerWebSurfaceReady · the Web surfaces group of the index