I’m working on a Razer Connected Device app and I have that part working in .NET using the Razer Chroma Broadcast.NET API. I’m updating the WLED via websockets at the moment. Razer Chroma uses 4 colors for a connected device.
I’ve figured out how to use websockets to update the led strip with the right colors. The problem is, after a while the connection seems to drop and the strip stops responding. Is UDP more stable? And if so, does anyone have an example on how to use UDP to change the led colors in .NET?
ESP8266 or ESP32?
ESP8266 only supports up to 3 concurrent WS connections and sometimes a single browser will use all of them.
Right now I’m using an SP511E, I think that’s an ESP8285?
In the mean time I’ve actually rewrote some code and I’m using a different Websocket library in .NET. Which seems to perform better, no more drops and this one easily reconnects. But still I keep bombarding the WLED with JSON every 40ms. Should I switch to UDP?
YES! The JSON API is only for state changes really and TCP in general has a (on ESP) non-negligible overhead. For JSON/WebSockets, an update rate of 1/second is recommended, and I’d say about 10/second is the maximum it will handle for longer periods of time.
Thanks, so far it has been working great over WebSockets even at 25 updates per second. I’ll see if I can change my code to using UDP. I don’t have any experience using UDP to do anything, so that’s going to be a challenge.
I’m going to have to familiarize myself with WARLS I guess. Any example projects I can check out that you know of?
Oh nevermind, that was VERY easy hahaha. It’s really fast and it seems to be working perfectly now. I’ll add a settings interface and then I’ll share it with the group
I use UDP in an industrial application where there is no possibility of network collisions (cable connects directly between the 2 devices). It depends on the application. If it’s something that does not depend on prior traffic for the proper results, then UDP is definitely a low overhead solution to data exchange.