Red - A simple, fast, and powerful networking library

I just want to give some more info on the current status of Red, as there are a few known issues that have gone unfixed.

  • I’m currently a student, and don’t have a huge amount of time to work on this.
  • The next update will be large, consisting of new utilities, utilities being separated from the main Red module, and the event core being completely rewritten.
  • I’m also working on another datastore library, just in the prototyping phase, no real solid ideas yet.

Over the next couple weeks I’ll be able to work on Red a bit more than I have.

2 Likes

Pretty good networking library (and the first one i’ve ever used.)

1 Like

Red 2.0 will be releasing very soon! (Code is done, working on docs)

This major update will contain very little change to networking with red (removing definitions completely, adding identifiers). The only breaking change is utilities not being included with red, and are now separate packages. This major version is a complete rewrite, and includes some minor implementation changes.

For all the wally users out there, Red will be changing scopes to redblox/red. There are many reasons for this, but the two primary reasons are: Enable me to release more packages in the same ecosystem, I’ve said I’m planning a datastore library (and it’s almost done too), and I want to do a lot more. The second reason is to protect the users from me changing usernames and enable more contributions.

If you read this whole post, then thank you! If you have a game using red right now, and want to test out Red 2.0 just message me on discord and I’ll help you try it out. The migration process is very minimal.

8 Likes

Hello!

I am trying to run Net:Call but for some reason I am being returned with the following message

Infinite yield possible on 'Players.7piral.PlayerGui:WaitForChild("Red")' - Studio Stack Begin - Studio Script 'ReplicatedStorage.Shared.Packages.Red.Net', Line 29 - Studio - Net:29 Stack End - Studio

Below is my code:

--SERVER
Net:On("GetProfile", function(Player)
	return DataManager.Get(Player)
end)

--CLIENT
function NetworkingManager.GetProfile()
	Net:Call("GetProfile"):Then(function(Profile)
		return Profile
	end)
end

Is this an issue with my code or red itself?

Make sure red is loaded on the server.

I believe it is fully loaded, I do have other remotes on different namespaces working as well

CC: @SpiralAPI

I created a temporary release of Red while 2.0 is in a weird state. This patches the bug with calling yielding functions on the server. You can download here.

1 Like

I am still receiving the same yield for some reason even after updating.

Heres a bit more of context to my code:

--server
local Net = Red.Server("Data")

local DataManager = {}

function DataManager.Get(Player)
	local Profile = Profiles[Player]
	if Profile then
		return Profile
	end
end

return DataManager

Net:On("GetProfile", function(Player)
	return DataManager.Get(Player)
end)

--client
local DataNetwork = Red.Client("Data")

local NetworkingManager = {}

function NetworkingManager.GetProfile()
	DataNetwork:Call("GetProfile"):Then(function(Profile)
		return Profile
	end)
end

return NetworkingManager

and simply running
print(require(game:GetService("StarterPlayer").StarterPlayerScripts.Client.Modules["Networking"]).GetProfile()) causes the yield to occur

I am unsure if this is caused by something in my code or the module, but hopefully this can help :grin:

What are you expecting to happen that isn’t happening?

it should just return the profile and print it out but nothing prints and it yields after a few seconds

This plugin is very cool! However, could you also add support for bindables please?

Really sorry I missed your response. Your issue appears to be in this code:

function NetworkingManager.GetProfile()
	DataNetwork:Call("GetProfile"):Then(function(Profile)
		return Profile -- this return is inside the Then callback
	end)
end

If you want GetProfile to yield and then return the profile this is what you should do:

function NetworkingManager.GetProfile()
	return DataNetwork:Call("GetProfile"):Await()
end
1 Like

This isn’t a plugin, it is a networking library to assist with networking between the client and server. You can use the Signal utility if you’re looking for something similar to bindables.

I tried to use :Await() but seem to be getting the same error? Do you have any idea what the cause could be?

Are you sure you’re using this version? That shouldn’t yield forever.

Double check that the server is actually returning something with a print and use Await on the client.

1 Like

I do have some interesting results that should help narrow this down

  • Upon using :Fire() it also shows the same yield error
  • It doesn’t actually print anything, even a simple print("Hello, world!") on the server so i am not sure its even contacting the server?
  • I have a second namespace in the same exact script, but its a OnClientEvent and it works perfectly fine. Im unsure if this is related to it or not but thought that would be helpful to know.

EDIT: On some more testing, I find it doesn’t even print on the client. I am using a :On() connection on a separate namespace above the same part, is this causing it? I will attach my full code below

--//Services
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

--//Imports
local Red = require(ReplicatedStorage.Shared.Packages["Red"])
local Effects = require(script.Parent["Effects"])

--//Constants
local LocalPlayer = Players.LocalPlayer
local EffectsNetwork = Red.Client("Effects")
local DataNetwork = Red.Client("Data")

--//Connections
EffectsNetwork:On("Vignette", function(Enabled, Type)
	if Enabled == true then
		if Type == "TimeZone" then
			Effects:VignetteOn("TimeZone")
		elseif Type == "SafeZone" then
			Effects:VignetteOn("SafeZone")
		end
	else
		Effects:VignetteOff()
	end
end)

--//Module
local NetworkingManager = {}

function NetworkingManager.GetProfile()
	print("Hi") -- This is not printing but the yield warning is showing 
	return DataNetwork:Call("GetProfile"):Await()
end

return NetworkingManager

Hey, so after trying a few new things I was able to get it working. Heres the steps I took to fix it:

  • I stopped using the command bar and used a script within the game itself to test, for whatever reason that seemed to be the main issue. I am still unsure why or if thats intended.
  • Instead of sending the entire profile (which was a cyclic table which ended up causing issues) i only sent the Profile.Data

So the command bar runs in it’s own environment, its kinda weird. Don’t run tests from it. Serializing cyclic tables will cause you no end of problems, so I’m glad you got all this sorted out. Let me know if you have any other questions!

1 Like

Hi,

I am testing how Red works and its working but getting the getting the message below, what am I doing wrong? is it because I have the server script in the Workspace?.

13:36:13.998 [Red.Serdes]: Retrieving identifier exceeded 5 seconds. Make sure ‘NamespaceName_EventName1’ is registered on the server. - Client

13:36:14.381: Test from server (x47) - Client - LocalScript:7

-- Server Script in Workspace
local Red = require(game:GetService("ReplicatedStorage").Red)
local Net = Red.Server("NamespaceName")
local Players = game:GetService("Players")

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		
		local player = Players:GetPlayerFromCharacter(hit.Parent)
		
		-- Fires a single player
		Net:Fire(player, "EventName1", "Test from server")
		
	end
end)

-- Client Script in StarterPlayerScripts
local Red = require(game:GetService("ReplicatedStorage").Red)
local Net = Red.Client("NamespaceName")
Net:On("EventName1", function(testext)
	print(testext)
end)

That warning exists for 1.x, I’ll be releasing 2.0.0 for studio soon which removes the warning. If you see that and it’s still working just ignore it.