@rbxts/tether 1.2.5 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -96,17 +96,13 @@ do
|
|
|
96
96
|
local schemaString = if schema ~= nil then " " .. table.concat(string.split(repr(schema[2], {
|
|
97
97
|
pretty = true,
|
|
98
98
|
}), "\n"), "\n ") else "unknown"
|
|
99
|
-
local text = { "\n", horizontalLine, "\n", "Packet sent to ", (if RunService:IsServer() then "client" else "server"), "!\n", " - Message: ", message, "\n", " - Data: ",
|
|
99
|
+
local text = { "\n", horizontalLine, "\n", "Packet sent to ", (if RunService:IsServer() then "client" else "server"), "!\n", " - Message: ", message, "\n", " - Data: ", repr(data, {
|
|
100
|
+
pretty = true,
|
|
101
|
+
}), "\n", " - Raw data:\n", " - Buffer: ", bufferToString(rawData.buffer), "\n", " - Blobs: ", repr(rawData.blobs, {
|
|
100
102
|
pretty = false,
|
|
101
103
|
robloxClassName = true,
|
|
102
104
|
}), "\n", " - Packet size: ", bufferSize + blobsSize, " bytes\n", " - Buffer: ", bufferSize, " bytes\n", " - Blobs: ", blobsSize, " bytes\n", " - Schema: ", schemaString, "\n", horizontalLine, "\n" }
|
|
103
|
-
|
|
104
|
-
local _result = table.create(#text)
|
|
105
|
-
for _k, _v in text do
|
|
106
|
-
_result[_k] = tostring(_v)
|
|
107
|
-
end
|
|
108
|
-
-- ▲ ReadonlyArray.join ▲
|
|
109
|
-
print(table.concat(_result, ""))
|
|
105
|
+
print(table.concat(text, ""))
|
|
110
106
|
end
|
|
111
107
|
end
|
|
112
108
|
end
|
package/out/message-emitter.luau
CHANGED
|
@@ -7,6 +7,7 @@ local _services = TS.import(script, TS.getModule(script, "@rbxts", "services"))
|
|
|
7
7
|
local Players = _services.Players
|
|
8
8
|
local RunService = _services.RunService
|
|
9
9
|
local Destroyable = TS.import(script, TS.getModule(script, "@rbxts", "destroyable").out).default
|
|
10
|
+
local repr = TS.import(script, TS.getModule(script, "@rbxts", "repr").out)
|
|
10
11
|
local _middleware = TS.import(script, script.Parent, "middleware")
|
|
11
12
|
local DropRequest = _middleware.DropRequest
|
|
12
13
|
local MiddlewareProvider = _middleware.MiddlewareProvider
|
|
@@ -14,8 +15,8 @@ local MiddlewareProvider = _middleware.MiddlewareProvider
|
|
|
14
15
|
local messageSerializer = createBinarySerializer({ "object_raw", { { "message", { "u8" } }, { "data", { "literal", {}, -1 } } } })
|
|
15
16
|
local remotes = Networking.createEvent("@rbxts/tether:message-emitter@remotes")
|
|
16
17
|
local metaGenerationFailed = "[@rbxts/tether]: Failed to generate message metadata - make sure you have the Flamework transformer and are using Flamework macro-friendly types in your schemas"
|
|
17
|
-
local guardFailed = function(message)
|
|
18
|
-
return `[@rbxts/tether]: Type validation guard failed for message '{message}' - check your sent data`
|
|
18
|
+
local guardFailed = function(message, data)
|
|
19
|
+
return `[@rbxts/tether]: Type validation guard failed for message '{message}' - check your sent data\nSent data: {repr(data)}`
|
|
19
20
|
end
|
|
20
21
|
local MessageEmitter
|
|
21
22
|
do
|
|
@@ -368,7 +369,7 @@ do
|
|
|
368
369
|
local guard = _guards[_message]
|
|
369
370
|
local guardPassed = guard(data)
|
|
370
371
|
if not guardPassed then
|
|
371
|
-
warn(guardFailed(message))
|
|
372
|
+
warn(guardFailed(message, data))
|
|
372
373
|
end
|
|
373
374
|
return guardPassed
|
|
374
375
|
end
|
|
@@ -391,8 +392,7 @@ do
|
|
|
391
392
|
return self
|
|
392
393
|
end
|
|
393
394
|
function MessageEmitter:onRemoteFire(serializedPacket, player)
|
|
394
|
-
local
|
|
395
|
-
local message = _binding.message
|
|
395
|
+
local message = buffer.readu8(serializedPacket.buffer, 0)
|
|
396
396
|
self:executeEventCallbacks(message, serializedPacket, player)
|
|
397
397
|
self:executeFunctions(message, serializedPacket)
|
|
398
398
|
end
|