Open halee88 opened 11 months ago
Yes, the plugins included are more or less "examples" on implementation and could definitely be improved for more use-cases. My original idea was that it would be up to the plugin if it would block or not on losc:open()
, the function signature can vary depending on the plugin implementation so a blocking flag could be implemented for a specific plugin.
Here is an example of a non-blocking implementation using libuv: https://github.com/davidgranstrom/osc.nvim/blob/main/lua/osc/udp-transport.lua it is callback based though, but I like the idea in #32 of an additional losc:poll()
function to handle non-callback based implementations.
Hello! I made a quick attempt at adding the :poll() method in PR #34 :)
Interestingly I needed that feature yesterday and it's currently being discussed here!
When launching a server, all plugins'
losc:open()
functions create an infinite loop without any way to exit it via code. Instead a user must forcefully terminate the lua runtime. This makes the server functionality impossible to embed in more complex applications.A solution would be to enforce a 'non-blocking' requirement on each plugin and adapt the high-level api as necessary (see #32). Backwards compatibility with existing 'blocking' usages could be accomplished by adding a default
blocking=true
param to thelosc:open()
function