How to send a json POST to remote (camera) API from Lua script?

ypwlng

New Member
Hello - I would like to send a POST to the camera API from Lua, directly if possible, on change of scene. I do not need to have the responses from the API.

Presently the workarounds I have tried are not suitable or not ideal.

1. os.execute to call Curl - there is a lag, and the scene change is delayed

2. io.popen a Python helper script; LUA ---io pipe---> Helper ---POST---> Camera API. With this it works, but there is the inconvenient cmd console window that needs to be closed/minimised

ChatGPT thinks that there is a "socket.http" library in OBS Lua - but there isn't.

I am using OBS 32.1.1 on Windows 11.

Thank you in advance for any help, suggestions, etc.
 
Hello — OBS Lua doesn’t support socket.http, so direct POST isn’t available. A simple workaround is to use a small compiled helper (e.g., Go/C) instead of Python to avoid the console window and reduce lag, or handle the POST externally via OBS WebSocket on scene change.
Thanks. I tried python compiled into an executable file, but the console window still appears. I looked briefly at OBS WebSocket - it seems to be for remote control of OBS. Are you saying that a helper file could be written to connect to Web Socket and poll for changes or listen for what OBS is doing?
 
Back
Top