obsproject / obs-websocket

Remote-control of OBS Studio through WebSocket
GNU General Public License v2.0
3.86k stars 707 forks source link

Cannot configure WebSocket Plugin to bind to IPv4 #1131

Closed houserockr closed 1 year ago

houserockr commented 1 year ago

Operating System Info

Other

Other OS

Alma Linux 9.1

OBS Studio Version

29.0.2

OBS Studio Version (Other)

No response

OBS Studio Log URL

https://obsproject.com/logs/mXBleDTVMQcit4B7

OBS Studio Crash Log URL

No response

Expected Behavior

The user should be able to configure the option --websocket_ipv4_only provided by obs-websocket in the WebSocket configuration dialog of OBS.

Current Behavior

With ipv6 disabled on Alma Linux 9, the WebSocket plugin doesn't work, because it will bind to ipv6 by default, which will fail:

14:54:42.836: [obs-websocket] [WebSocketServer::onObsLoaded] WebSocket server is enabled, starting...
14:54:42.837: [obs-websocket] [WebSocketServer::Start] Not locked to IPv4 bindings
14:54:42.839: [obs-websocket] [WebSocketServer::Start] Listen failed: Address family not supported by protocol

However, I cannot find a way to configure the option --websocket_ipv4_only which obs-websocket provides. Me, personally, I wouldn't necessarily need an HMI option if there's another way to add that parameter to a script in the background.

The option has been added with: https://github.com/obsproject/obs-websocket/pull/559 https://github.com/obsproject/obs-websocket/pull/928

Steps to Reproduce

Precondition: Linux with ipv6 disabled by kernel option

  1. Enable the WebSocket plugin in the configuration
  2. Restart OBS
  3. Check the log or
  4. $ sudo netstat -tapn | grep LISTEN ...

Anything else we should know?

No response

houserockr commented 1 year ago

In case this might be relevant, this is how my WebSocket configuration dialog looks like Screenshot from 2023-04-29 15-24-13

tt2468 commented 1 year ago

Do you have a use-case where you need to bind to IPv4 specifically? By default, obs-websocket binds to all interfaces on v6, which still allows v4 connections to be created. Someone previously had claimed that they could only connect if obs-websocket was locked to only IPv4, so I added the feature. I never added it to the UI because one user having an issue did not seem to warrant changing the UI.

houserockr commented 1 year ago

First of all, I can mitigate this observation to some extent, because it works now.

Here's how the observation came about:

Here's how/why it still works:

Here's the use case that still stands imho: It's more of a precondition than a use case. If OBS is running on a machine with ipv6 disabled, WebSocket won't run at all. I don't know if this only applies to Linux, but I assume it also applies to other OSs. Me personally, I've seen many machines with ipv6 still disabled by default, but I don't have any stats on that. I let you guys decide whether that's relevant or not.

tt2468 commented 1 year ago

Fixed by creating a fallback to IPv4 if we get the address family not supported error: https://github.com/obsproject/obs-websocket/commit/6434c421556c25397d9af7b21365796cd6c7a715