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

Websocket stuck on "connecting" #742

Closed
nacalai opened this issue May 6, 2023 · 9 comments · Fixed by #743
Closed

Websocket stuck on "connecting" #742

nacalai opened this issue May 6, 2023 · 9 comments · Fixed by #743

Comments

@nacalai
Copy link

nacalai commented May 6, 2023

Hi there. This might me being stupid and not doing things right. Oooor..it might be the plugin.

I love that WS has been added. I am trying to connect to this WS connection. In the console, it does say "received connection" in green. So..seems like it should work. However as you can see in the obs window, it's stuck on "Connecting".

image

I tried making a macro, and nothing happens.

image

Am I doing something wrong, or is there a bug or something?

@nacalai
Copy link
Author

nacalai commented May 6, 2023

Oh, so it does receive input. But how can I format it properly for ball_hit, for example?

image

@WarmUpTill
Copy link
Owner

WarmUpTill commented May 6, 2023

You are already almost there! :)

Seems like the problem is that you are not setting an opcode in accordance to the obs-websocket protocol.
Thus the message will be discarded.

I think what you will have to do is send a request - so use opcode 6.
But note that you will also have to adjust the condition in the macro to use the "Request" message type instead of "Event" type.

The json object that you will have to send to OBS will have to look something like this:

{
    "op": 6,
    "d": {
        "requestType": "CallVendorRequest",
        "requestId": "Example request - ws://localhost:4455",
        "requestData": {
            "vendorName": "AdvancedSceneSwitcher",
            "requestType": "AdvancedSceneSwitcherMessage",
            "requestData": {
                "message": "game:ball_hit"
            }
        }
    }
}

Let me know if you have questions / run into issues!

@nacalai
Copy link
Author

nacalai commented May 6, 2023

Thanks for the quick answer! I will admit this is outside of my expertise, and not sure how I personally can fix it. This is a websocket plugin for the game Rocket League, which I am simply listening to, and trying to trigger on commands. Will the plugin itself have to be altered?

They do also have a ws-relay. Perhaps it can be altered to send what is required? https://gitlab.com/bakkesplugins/sos/sos-ws-relay

I also tried using regex matching..to simply scan everything..but to no avail

@WarmUpTill
Copy link
Owner

Currently only connections conforming to the obs-websocket protocol are supported.

In the linked PR I drafted the option to specify that a given connection should ignore the obs-websocket protocol and instead reacts and send out plain-text messages.

WSNoOBS

I think that should allow you to react on the Rocket League websocket events using a macro setup like you shared above.

A build should be available here in a few minutes:
https://github.com/WarmUpTill/SceneSwitcher/actions/runs/4903689387?pr=743

Let me know if that works for you! :)

@nacalai
Copy link
Author

nacalai commented May 6, 2023

I was just about to suggest that, to be able to just ignore obs-ws protocols altogether and just simply listen. Perfect! I'll try it very soon

@nacalai
Copy link
Author

nacalai commented May 6, 2023

So, I'm trying it, but it doesn't seem to receive anything.
image

But you can see that it did receive something at first, in red. But unticking the box and trying to connect, it seems to doesn't receive. But connection says ok

@nacalai
Copy link
Author

nacalai commented May 6, 2023

Wait wait wait so the log will not output anything, but it is indeed receiving! I used "ball_hit" with regex partial match and it is working. Wow perfect. Thank you. Not sure if it can be outputted to log, for troubleshooting reasons in the future?

@WarmUpTill
Copy link
Owner

WS messages will still be logged if you enable verbose logging.
Does this not work for you?

The log messages you observed previously were error logs which will be printed regardless of the verbose logging setting.

@nacalai
Copy link
Author

nacalai commented May 11, 2023

Ah, right. Forgot about that. Well, it all works well now. Superb stuff. I'll close this. Thanks

@nacalai nacalai closed this as completed May 11, 2023
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

Successfully merging a pull request may close this issue.

2 participants