Roblox-Long-Polling A Node.JS Module to Make Real-Time Communication Easy [Scalable Version Now Available]

How do I stop the Roblox side (Client) from continuing to run past the shutdown deadline?

Iā€™ve discovered this bug and meant to push my fix to GitHub but I havenā€™t quite got around to it. Do me a favor and DM me here on the dev forum and remind me to do it.

Just did! Thanks for this library, as it truly is an excellent use for connecting between my Node.js backend API for my service and Roblox!

1 Like

Update! We had a bug rolled out where we were not decoding messages on the node-server end of things. This has since been fixed, if you are having issues where itā€™s not working just upgrade your back-end/node version and the issue should subside. Sorry for any inconvience.

yo i just found out about this and this seems pretty nice!!

i must ask tho, what is the license?
am i able to use it in commercial projects?
(also once again this was exactly what i was looking for lol)

I havenā€™t attached a license, as itā€™s open source. Itā€™s free to use, commercially, publically, or in any way you want. We guarantee no warranties or any guarantees at that. Youā€™re free to use it as you wish (as long as you are not claiming it as your own).

epic, thanks man

thisll help a lot with my ideas regarding remote stuff

Hey there! Awesome idea, Iā€™ve thought of doing this for a bit of time, but you just saved my life, lol, mind if I take it and optimize it a little more?

He is using the MIT License, which means that heā€™s OK with people sharing modified source code, with some limitations. See this for an overview of the MIT License.

I know. I just want to be nice and ask first :slight_smile:

1 Like

Yes, you are okay to make modifications to the code. Thanks for asking!

Is there a python version of this? Iā€™m currently struggling to make a system where the applications get sent through roblox to discord bot for review.

I donā€™t think so but itā€™s definitely possible to make one.

hey, I dont think :Disconnect() is working properly. I added a few print statements within the statement after the request is issued and they never fired. The Disconnect function also timeouts when given enough time.

edit: it was a spelling error within my program. I fixed it, however even upon disconnect the pings continue. This causes extremely long close times for servers. I am wondering if there is any way to disconnect 100% and stop pings so that servers can close easier.

edit 2: It seems the issue was on line 65 and 66 of the Connection ModuleScript.

game:BindToClose(close);
game.Close:Connect(close)

these bind this function to when the server closes:

local function close()
	HttpService:RequestAsync({
		Url = newConnection.url.."/connection/"..newConnection.id,
		Method = "DELETE",
	})
end

this RequestAsync is never satisfied and so it hangs permanently. I have 0 use for this bind to close as I disconnect all of my connections before the server shutdown in a seperate script so I just removed it. This made servers go from taking 20-30 seconds to close to taking under 1.

1 Like

So apparently, there was a typo made in the instructions:

connection.on('dsconnect', () => {})

Itā€™s actually disconnect.

connection.on('disconnect', () => {})

This fixed it for me. Hope it helps!

(i noticed that even though the server receives the disconnection, in game it still gives the HttpError: Timedout message)

Thanks for the heads up. Going to fix some bugs with this soon once I have the chance, just been very busy lately.

No problem. I wrapped the :Disconnect function in a pcall to avoid getting the error. Mind that you should update the source code to use the task library as it is kinda old by now.

Edit: I just wrapped the close function in it too. Iā€™m getting a ā€œNot running script because past shutdown deadlineā€ error, as my game freezes when stopping it. (still getting the error)

Edit #2: This is good.

local function close()
	pcall(function()
		local success = false
			
		task.spawn(function()
			HttpService:RequestAsync({
				Url = newConnection.url.."/connection/"..newConnection.id,
				Method = "DELETE",
			})
			success = true
		end)
		
		task.wait(5)
		
		if not success then
			return
		end
	end)
end