This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Websocket message revieve crashing
#1
Hello,
I'm using websocket library to connect to Unifi Access device and receive status info from it, but the problem i have is once i receive status update, the message is too long to even fit into the logs line and the whole script crashes without an error and i need to restart the script for it to start receiving status updates again. The websocket library is a little bit too complicated for me to understand what I'm looking for to fix this.

Maybe someone else has had a similar issue and knows how to fix this?

I attached the event script I'm using for connection and websocket library file.

Thank you in advance!

Attached Files
.lua   websocket.lua (Size: 15.37 KB / Downloads: 6)
.lua   event_script.lua (Size: 2.65 KB / Downloads: 9)
Reply
#2
Such script must be a resident script, not event. The message format is JSON so you need to decode the message and check the relevant fields instead of relying on string.find
Reply


Forum Jump: