Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check OBS connection and reset #60

Closed
Epyxx opened this issue Dec 20, 2022 · 5 comments
Closed

Check OBS connection and reset #60

Epyxx opened this issue Dec 20, 2022 · 5 comments

Comments

@Epyxx
Copy link

Epyxx commented Dec 20, 2022

Hey,
is there a way to check the OBS connection status on command?

For example something like this:

OnCommand bm 0 !check
If OBSConnected = true
Chat Send "Connected to websocket"
Else
Chat Send "Not connected to websocket"

Or alternative output an connection error at OnInit event?

For Example:

OnInit
If OBSConnected = false
Chat Send "Websocket connection error"

Thanks!

@Kruiser8
Copy link
Owner

Hey Epyx,

It's possible to check if it was connected on start up. It's not possible to check active connection status without making a call. OBS Version is probably the easiest one to run, however I think that throws an error and doesn't continue when there's an issue.

To check if it was connected on start up:

OnCommand mb 0 !check
Param Keyword _successful_ obs
if 2 {matched} == true
Chat Send "Websocket was connected"
Exit
Chat Send "Websocket connection error"

@Epyxx
Copy link
Author

Epyxx commented Dec 20, 2022

Thanks! i think this command should be enough for my case.
But i copied your lines of code and tried it but i get no message at all.
neiher "Websocket was connected" nor "Websocket connection error" :(

@Kruiser8
Copy link
Owner

Huh, I tried it and it worked. However, I noticed a quirk with Param Keyword that you'll have to add a workaround for:

OnCommand mb 0 !check
Param Keyword _successful_ obs,
if 2 {matched} == true
Chat Send "Websocket was connected"
Exit
Param Keyword _successful_ obs
if 2 {matched} == true
Chat Send "Websocket was connected"
Exit
Chat Send "Websocket connection error"

OnCommand mb 0 !check
OBS Version
Chat Send "Version: {version}"

In the next update, I'll make it so OBS Version returns Disconnected in the event that it isn't connected. That should fit your use case. That will look like:

OnCommand mb 0 !check
OBS Version
If 2 {version} == "Disconnected"
Chat Send "Websocket connection error"
Exit
Chat Send "Websocket was connected"

@Epyxx
Copy link
Author

Epyxx commented Dec 22, 2022

It now works for me, thanks!

Oh yeah, a live check with obs version would be awesome!

@Kruiser8
Copy link
Owner

This is added in the upcoming release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants