Open thebenign opened 7 years ago
You're right, and the documentation has been corrected in some of the more recent updates. (Which will come soon!) The actual connection event doesn't occur until the next time the client and server are updated. So, there's no way to tell if a connection succeeded at the time the connect method is called.
Thanks for the reply! I did notice that when I looked through the code. It makes sense with how enet handles peer creation / connection. Do you plan to implement this feature some other way?
For now, you can just set some connected state when the "connect" event goes off.
-- client code
connected = false
client:connect()
client:on("connect", function()
connected = true
end)
The documentation states that Client:connect() will return a boolean value indicating whether the connection was successful or not. It currently returns nil in every case.