FastNet - a Fast, low-latency, efficience, low bandwidth usages & high-performance | Now with AES-128 bit for Security

FastNet

Were migrating to FastNet2, recomanded using FastNet2 than FastNet, FastNet will no longer be updated, Thanks for using it!


FastNet - Depracated

Hello, everyone!
so, today i want to share my first time made networking system

This FastNet module is networking module with rateLimiter and queue system. but it’s really powerful (Very Fast, low latency, low bandwidth usages and high-performance)
also you can change the default FastNet settings in FastNet Module like this

Pros on FastNet:

  • More secured with AES (very hidded secret key, optional on settings)
  • Encoded data packets (automaticly decoded when receives)
  • Low bandwidth usages (Highly compressed, the smallest is 2 bytes)
  • Custom RateLimit to Player
  • Stabled Efficiency & Optimized
  • Faster
  • Thread Reuse (Client)
  • RateLimits & Queues System
  • Debugging (optional)
  • Traffic Logs
  • Fire back after receive (optional, likely RemoteFunction)
  • Easy to use
  • Custom Timeout system (yielded) on RemoteFunction
  • Anti-Spam on Remotes Receiver (optional)

Cons on FastNet:

  • Disable RateLimiting & Queue make unstablled or very-high/massive limition size
  • AES Encryption is slow when handling alots data to encrypted
  • AddLimit / AddLimitAll may extra performance taken
  • AES Encryption System enabled requires extra performance for secure their keys
  • Easily RateLimit handler outdated (not at all)

Note: For version 2.9.x

APIs
Server & Client

Server-Side



Client-Side

Download Source

GitHub: here
Roblox Library: here
Download File (.rbxm, ver2.9.9-beta2, b_2990):
FastNet.rbxm (46.7 KB)

Example

-------- SERVER SCRIPT SIDE --------

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Network = require(ReplicatedStorage:WaitForChild("Network"))

-- Create New Remote (typeRemote, NameRemote)
local Remote1 = Network:Create("RemoteEvent", "Remote1")
local Remote2 = Network:Create("RemoteFunction", "Remote2")

-- RemoteEvent.OnServerEvent
Remote1:Listen(function(player, data_receive)
	print(player, data_receive)
end):Connected("Remote1 Connected!")
-- RemoteFunction.OnServerInvoke
Remote2:Listen(function(player, data_receive)
	print(player, data_receive)
end):Connected("Remote2 Connected!")

------ CLIENT LOCAL SCRIPT SIDE ------

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Network = require(ReplicatedStorage:WaitForChild("Network"))

-- Name Remote, data to sent
Network:Fire("Remote1", "Hello!")
Network:Invoke("Remote2", "Welcome!")

RateLimit Test

------ CLIENT LOCAL SCRIPT SIDE ------

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Network = require(ReplicatedStorage:WaitForChild("Network"))

while task.wait() do
	task.spawn(function()
		Network:Fire("Remote1", "Hello!")
		Network:Invoke("Remote2", "Welcome!")
	end)
end

Comparison Speedtests (Stress-Benchmark)

Benchmark 1 (FastNet v1.0-Beta)


Benchmark 2 (FastNet v1.0-Beta)

Benchmark 3 (FastNet v1.1-Beta)

Benchmark 4 (FastNet v2.0-release, 75 fires per frame)
image
Benchmark 5 (FastNet v1.3-beta, FastNet RateLimiter Settings disabled/off)
image
Benchmark 6 (FastNet v2.0-release, 30 fires per frame)
image
Benchmark 7 (FastNet v2.0-release, 125 fires per frame)
score


Benchmark 8 (FastNet v2.0-release, 75 fires per frame)

Benchmark 9 (FastNet v2.0-release, BridgeNet v2.0.0-rc4)




Benchmark 10 (FastNet v2.1-release, BridgeNet v2.0.0-rc4)

That pictures showing compare stress benchmark result using RunService.Heartbeat no delations for 30s (BridgeNet seems unstable), and FastNet Module is really keep stable to handle many Remote calls connection.

Note

BridgeNet Module 2.0.0-r3 version (except benchmark 9 & 10)

Latest version: 2.9.9 - Beta2
Stable version: 2.2/2.3/2.6/2.7/2.8.x/2.9.x - Beta

18 Likes

Hmm, what does this offer compare to BridgeNet? It seems like all these networking modules started popping after BridgeNet was released so I want to know what this module offer compare to BridgeNet.

12 Likes

MINOR UPDATE - v1.1 - Beta

Added :Remove Function (Server)

local Remote = Network:CreateRemote("RemoteEvent", "Remote1")
Remote:Remove()

OR

Network:Remove("Remote1")

:Remove() function used for remove/destroy the remote

Added new thing when created remote

local NetRemote = Network:CreateRemote("RemoteEvent", "Remote1")
local NetRemote2 = Network:CreateRemote("RemoteFunction", "Remote2")
NetRemote.Remote:Connect(function(player, data_receive)
end)
NetRemote2.Remote.OnServerInvoke = function(player, data_receive)
end

Previous method still can be used

Network:ListenServerEvent("Remote1"):Connect(function(player, data_receive)
end)
Network:ListenServerInvoke("Remote2") = function(player, data_receive)
end)

:CreateRemote() now return table

Added :GetVersion() - Server & Client

print(Network:GetVersion())

Added Back :ListenClientInvoke() & :ListenClientEvent() Function (Client)

Network:ListenClientEvent("Remote1"):Connect(function(data_receive)
end)
Network:ListenClientInvoke("Remote2").OnClientInvoke = function(data_receive)
end

Removed :Controller() Function (Client)
so you can instantly use the module on client

local Network = require(ReplicatedStorage.Network)
Network:FireServer("Remote1", "Yo! Update 1.1??")
Network:ListenClientEvent("_Update"):Connect(function(...)
end)

Changes on Default Settings
Bugs Fixed, Improvement Syntax & Functional

3 Likes

MINOR UPDATE - v1.2 - Beta

Added :GetLogTraffic() Function (Server & Client)

local Network = require(ReplicatedStorage.Network)
Network:GetLogTraffic() -- return tables

Fixed Queue System & Faster Queue workload

2 Likes

hey I was adding this in bridgenet 2.0.0-rc4, is this function inspired from EasyNetwork?

also cool project!

4 Likes

MINOR UPDATE - v1.3 - Beta

now some function use Promise
Bugs Fixes and Improvements

1 Like

NEW UPDATE - v2.0 - Release

What new?

Now you no longer need :Init() to start the network, you can instantly use the module.

Added :WaitForListen(delay : number : optional) on :CreateRemote()
Example:

local Remote = FastNet:CreateRemote("RemoteEvent", "Remote1")
Remote:WaitForListen():Connect(function(plr, ...)
end)

Added something on Remote:Remove( string : message )
Example:

local Remote = FastNet:CreateRemote("RemoteEvent", "Remote1")
Remote:Remove("The remote is removed")

output-console-log:
> [FastNet]: The remote is removed

Now any connection network returns JSONEncoded string for the packet data compression, so to decode it use FastNet:Dec(any : JSONEncoded)
Example:

Remote:WaitForListen():Connect(function(plr, ...)
print(plr, FastNet:Dec(...))
end)

Now every max queue reached new queues will be rejected while queue is full

Now every Remotes Fired/Invoked the data_to_sent will be compressed to JSONEncode Format for smaller packet data (byte) taken [tested & compared)

Removed Promise (while having issue)

Bugs Fixes & Optimizes

Download here
FastNet.rbxm (6.3 KB)

2 Likes

image
Compare - Speedtest (FastNet v2.0-Release vs Native-Roblox vs BridgeNet 2.0.0-rc3)

BridgeNet receive highest sent byte (65-71kB/s, 98.7-113ms)
Native-Roblox (6.3-6.9kB/s, 967-1497ms)
FastNet (2.4-3kB/s, 71-94.3ms)
Benchmark using RunService.Heartbeat (no delations)
75 fires per frame

2 Likes

I still have some issues
gg
Yes

3 Likes

Fixed the bug/issue

Download newer here:
FastNet.rbxm (6.2 KB)

also thanks for reporting the issue :slight_smile:

2 Likes

Small Update - Quick Fix

Fixed an issue on queue from rateLimiter

Download here:
FastNet.rbxm (6.3 KB)

its also available on Roblox Library.

2 Likes

could we speak in private message, I’d like to know how to set it up (Im a bit slow i don’t really understand the tutorial) could you go into details, etc

2 Likes

added 2 more benchmark result (type: 30 & 125 fires per frame)

1 Like

benchmark 7 (completed, posted)

Small Update - v2.0-release (same version)

Now FastNet:Remove( nameRemote, message ) now support output message like Remote:Remove( message )

Small Fix
Download here
FastNet.rbxm (6.1 KB)

Added Benchmark 9 comparison (BridgeNet v2.0.0-rc4, FastNet v2.0-release, EasyNetwork (All Latest version))

NEW UPDATE - v2.1 - Pre-Release

Added :GetRemotes( typeRemote : string ) (Server & Client)
typeRemote mean like spesific type remote (RemoteEvent ? RemoteFunction)

print(FastNet:GetRemotes()) -- print remotes with table format {["RemoteName"] = SignalRemote}

Added :ClearRemotes() (Server)

Instead clear/destroy all remotes created on FastNet

return boolen value (true/false), true : successfuly cleared/destroyed all remotes created, false : there no any remotes available/exists

Changed default settings

RateLimiter > MaxLimit (35 → 75)
Queue > MaxQueue (50 → 500)

Shorten code lines (not much)
Bugs Fixes & Minor Performance optimized

Download here (v2.1-release):

FastNet.rbxm (6.8 KB)

Extra: New benchmark comparison soon (added to benchmark #10)

NEW UPDATE - v2.2 - Pre-Release


Added :AddLimit( player : Instance , MaxLimit : number, ResetTime : number ) (Server)
It’s like for anti spam for spesific player like RateLimiter

print(FastNet:AddLimit(player, 50, 1.5)) -- return {true/false} it will add into RateLimitPlayer list (not RateLimiter)

Added :RemoveLimit( player : Instance ) (Server)

Instead remove player from rateLimitPlayer list

return boolen value (true/false), true : successfuly removed the player from list, false mean player not in list or fail

Small Fix (not important)

Download here (v2.2-release):
FastNet.rbxm (8.6 KB)


IMPORTANT NOTE FOR THIS VERSION

USING :AddLimit(…) Function may increase SendPacket size and may reduce performance. so i suggest just use RateLimiter i made this function only if needed, keep stay on v2.1 if you dont need this function for you project!

RateLimiter & RateLimitPlayer aren’t same

1 Like

NEW UPDATE - v2.3 - Pre-Release


Reduced Network Bandwidth Size [34 bytes -> 4 bytes]

Our stress-benchmark test [125 fires/frame] (v2.3 vs v2.2): v2.3: ~6.36-7 kB/s (sent), v2.2: ~10.3-11.4 kB/s (sent) so the differents is upto 41-42% lower than previous version one.

Minor Performance Optimized (Faster Compress Enc & Dec)


*This update focused on bandwidth usages optimization

Download (FastNet v2.3):

FastNet.rbxm (9.8 KB)

Hey there, I’m awfully worried about the massive amount of updates you’re putting out, could you please try to compress these down or at least keep an officially LTS and production-ready version.

You’ve now semver’d up to 2.3 in 5 days of the project existing, so either you’re really unsure and I don’t feel safe using this, or you don’t know how to use semver to properly show your process.

Roblox-TS and Wally support would be nice and actually being able to see your code on GitHub would be a nice sign and of much use. Overall I’m not going to even contemplate using this until you refine everything and fix your practices, I’m sticking to BridgeNet.

Look into Rojo!

10 Likes

I also feel like I’m marching in uncharted territories attempting to use FastNet. I’d absolutely love a production-ready build, for now I’d probably stick to BridgeNet for the teensiest more stability.

8 Likes