Having Godot listen for HTTP requests
Asked Answered
M

1

0

Hello, my apologies if this is actually super clearly written out somewhere and I've missed it, but here's the situation:
I'm making a little randomized 3d animation in godot that I want to pop up as a Twitch redeem. For this I need some way to have the godot application open but not focused until the redeem is made (where it changes scene to the one with the animation). My first thought was to have a key, say F20 or something enable the redeem however it seems Godot can't monitor for global keypresses or I'm missing how to do it.
So my second thought is to make a simple local server that listens for HTTP requests to go to the proper scene, but I can't figure out how to do this. I'm using godot 4.0 and tried version 13 and 16 and can't get it to work on either.
This is the example code I tried to use:
https://docs.godotengine.org/en/latest/tutorials/networking/websocket.html#minimal-server-example

The editor says WebSocketServer doesn't exist though? Is there some prerequisite I'm missing?

Line 6:Could not find script for class "WebSocketServer".

Also if you can figure out a better way to trigger the redeem do let me know. I need a way to do it that doesn't disturb whatever else is happening on stream, so nothing that steals focus or the like.

Mcmillan answered 31/1, 2023 at 8:0 Comment(0)
M
0

Oh I found an answer why WebSocketServer doesn't work:
https://github.com/godotengine/godot/pull/66594
So the examples in the documentation are no longer accurate. Now I just need to see if I can figure out how to use WebSocketPeer for a server instead.

Mcmillan answered 7/2, 2023 at 17:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.