SirMallard / Iris

Iris is an Immediate-Mode GUI Library for Roblox for creating debug and visualisation UI and tools, based on Dear ImGui,
https://sirmallard.github.io/Iris/
MIT License
164 stars 25 forks source link

RemoteEvents don't function correctly when using rbxnet #34

Closed zwinplayer64 closed 11 months ago

zwinplayer64 commented 1 year ago

Unsure whether it's my issue or not, but any request gets rejected when using Iris to send it. Button code:

if Iris.Button({ "Button" }).clicked() then
    local remote = remotes.Client:Get("PrintMessage")
    remote:SendToServer("This should be printed")
end

Server-side code:

remotes.Server:Get("PrintMessage"):Connect(function(plr, message)
    print(message)
end)

Error itself: net.out.definitions.ClientDefinitionBuilder:54: Expected Promise rejected with no value. Everything works perfectly fine when using a vanilla Roblox button and the message gets printed.

Rbxnet: https://rbxnet.australis.dev/

JakeyWasTaken commented 12 months ago

Seems more like an rbxnet issue

SirMallard commented 11 months ago

I tried having a look at the documentation for RBXNet but I wasn't quite sure how it works. Within the Iris loop, there shouldn't be any asynchronous code which would prevent the entire code from finishing. I presume that would be the issue, but I'm not quite sure. I'll see if I can do some testing with this.

Michael-48 commented 11 months ago

This appears to be intended behavior. In an Iris execution cycle, a coroutine is spawned and if its lifecycle is not concluded when the next Iris cycle is initialized, then the coroutine is ended. In most scenarios involving asynchronous code inside of an Iris cycle it is best practice to spawn a thread and keep all GUI code synchronous.