For a good bug report you should probably include:
- Client (production/canary) and FXServer version: Canary b2372, FXServer 4359
- What you expected to happen
SendDuiMessage to work earlier - What actually happens
SendDuiMessage only work after 5sec or more after IsDuiAvailable - Category of bug (eg. client, server, weapons, peds, native)
client - Reproducible steps, preferably with example script(s)
Hello,
DUI became really slow before accepting messages.
Before, loading a page using CreateDui was way faster, now it can takes up to more than 5 seconds for the page to be ready (to be visible or accepting SendDuiMessage).
Not really a bug but there was definitely a regression there.
Here is a repro resource:
duiRepro.7z (873 Bytes)
Lua part:
local StartTime
local DuiObject
RegisterNUICallback('ready', function(data, cb)
print("HTML Ready took "..(GetGameTimer() - StartTime).."ms")
SendDuiMessage(DuiObject, json.encode({ message = "ready" }))
end)
Citizen.CreateThread(function()
StartTime = GetGameTimer()
DuiObject = CreateDui("https://bubblitobucket.s3.eu-central-1.amazonaws.com/dui.html", 1280, 720)
while not IsDuiAvailable(DuiObject) do Citizen.Wait(0) end
print("IsDuiAvailable took "..(GetGameTimer() - StartTime).."ms")
SendDuiMessage(DuiObject, json.encode({ message = "IsDuiAvailable" }))
end)
Web part:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js" crossorigin="anonymous"></script>
<script>
$(window).on('message', function($event) {
console.log(event.data.message);
});
$(document).ready(function() {
$.post("https://duiRepro/ready", JSON.stringify({}));
});
</script>
</body>
</html>
As you can see first SendDuiMessage is not processed and it takes 5 seconds before being ready to accept messages