openOMSI GitHub Discord
Plugin API reference

Docs / Plugins / Plugin API reference

Local UDP

1 min readEdit this pagedocs/PLUGIN_API.md

omsi.send talks to other programs on the same computer. It never reaches the network.

omsi.send#

omsi.send(port, data) → true, or false and the reason

Sends data as one UDP datagram to 127.0.0.1:port: to another program on this computer, never over the network. Not sent when the port is below 1024 or one of the game's multiplayer ports (27015-27024), the message is longer than 8 KB, or the plugin sent 100 in the last second.

Parameters: port integer; data string.

Since 0.2.21. Permission: network_local.

Lua
omsi.every(0.5, function()
  omsi.send(47800, omsi.json.encode({ speed = omsi.speed() }))
end)

Something wrong or missing? Fix it on GitHub or open an issue.

↑↓ to move↵ to open