Connect Sync
There is little to no downside of using
light.connect()
, this function exists for optimizing frequently sent messages in potentially
large servers (or for optimizing memory usage.) If that's not you, you should skip this page.
light.connect_sync()
does the same thing as light.connect()
with one major difference. Thread reuse will not be used with light.connect_sync()
, and
the function will be called directly. This means if you yield in your callback, you could get a buffer access out of
bounds or cause other unexpected internal issues. If you don't know what that implies, use
light.connect()
.
This function can error if there is already a callback connected.
Consider calling light.disconnect()
first if this is an issue.
function light.connect_sync
function light.connect_sync
An example client-side event polling utility using light.connect_sync()
:
And an example on how to use the above poll util: