Would it be possible to connect to a websocket with roblox? I don't need directly, like say GetAsync my website with the javascript websocket, but it doesn't keep the connection. If you wanna know what I'm using this for it is a "Roblox hosted discord bot" I've already got a working version and it does what I need it to, but a way to do some type of connection with a websocket or someting would boost this a lot.
Here is the "websocket" connection I attempted
local http = game:GetService("HttpService") spawn(function() while wait(3) do http:GetAsync("private_url") end end)
The reason that failed is because of two reasons 1. For the bot to stay online/etc it'd have to be constant connection 2. I have to wait 1-2 seconds until I can connect to the websocket
try this
local http = game:GetService("HttpService") spawn(function() local maxReqPerSec = 3 while this.alive == true do local tm = tick() http:GetAsync("your_url") local dur = (tick() - tm) local waitTime = math.max(0,((1/maxReqPerSec) - dur)) wait(waitTime) end end)