BridgeNet2, v1.0.0 | A blazing fast networking library for Roblox

Hey, I was just wondering if .new has been replaced with the ClientBridge and ServerBridge thing? If so, how does the firing work for it now? Sort of a little confused with the documentation.

Help much appreciated!

BridgeNet2 has never had a public new function for ClientBridge or ServerBridge, it’s always been prefixed with an underscore. ReferenceBridge is how you’re supposed to create bridges, ClientBridge() and ServerBridge() are just if you want slightly better typechecking.

I don’t think there were any major breaking changes in 0.4.0

So for clarification, this is the correct usage of creating and connecting an event within Bridgenet2?

local SpellCaster = BridgeNet2.ReferenceBridge(“SpellCaster”)

SpellCaster:Connect(function(…)

end)

1 Like

Yes, the way you did it is perfectly fine.

You can also do it this way for better type checking like ffrostfall said though:

--//Server code
local SpellCaster = BridgeNet2.ServerBridge("SpellCaster")

SpellCaster:Connect(function(…)

end)

--//Client code
local SpellCaster = BridgeNet2.ClientBridge("SpellCaster")

SpellCaster:Connect(function(…)

end)
1 Like

Would Player be included in the …

No, that is a separate argument.

Should I release documentation without api docs, but with high-quality tutorials and examples?

  • Yes
  • No

0 voters


Are connections important enough to have a dedicated Connection class?

  • Yes
  • No

0 voters


Is the current state of middleware/rate-limiting stable, or is it missing a lot and generally low-quality?

  • Stable, decent enough to use.
  • No, it is not stable or it is badly implemented.

0 voters

How do you use Bridgenet2 in a single tool with a local and server script?

version 0.5.0: 6/21/2023

Added

  • Added ServerBridge.OnServerInvoke and ClientBridge:InvokeServer()
  • Added .Connected to connections

Fixes

  • Fixed a bug with Bridge:Wait

Improvements

  • Refactored the object-oriented programming pattern used w/ Bridges
  • Connections are now their own class
  • Calling methods with . instead of : will now error
  • Type improvements
  • tostring()-ing a bridge will now return its class type
6 Likes

New (partially finished) documentation!

5 Likes

Hi,

I am trying to send multiple data from the server to the client but the array I send only sends the first value, value [1] is always nil.

I am using version v0.5.0

–Server
SoundBridge:Fire(Player, {“20”, “PlaySoundEffect”})

–Client
SoundBridge:Connect(function(values)

print(tostring(values[0])) -- shows 20
print(tostring(values[1])) -- shows nil

end)

image

Hi,

I got it working by creating the table below, not sure why the above code does not work as well.

SoundBridge:Fire(Player, {[“id”] = “20”, [“sound”] = “PlaySoundEffect”})

It looks like values[0] is nil because Luau arrays start at the index of 1 unlike other languages where it starts at 0.

3 Likes

This issue does not occur in Roblox studio very weird.
I have implemented it both on the client and server.
Any idea what might be causing this issue?

Edit: The issue has been resolved, it was a problem on my end. I thought it might be a bug due to the fact that the error was only displayed on Live Servers.

This module would help me reduce RemoteEvent issues. Thank you so much!

Good day,

I am having a strange error and I hope someone can help, when I debug my script and it gets to my line below “SoundBridge:Fire(Player, “21”)” it jumps to the ClientBridge script line 57.

I am using the same code in another script and it works, what is the error telling me? the Player value is not nil. The Fire is not sent to the client.

– ClientBridge script


– My Script
image
Output
image

I just found out you can enable logging, when I do this is the output.

Can you show me where SoundBridge is declared?

Hello :wave:
Using BridgeNet2 I ran into a problem, for some reason I can only join the bridge once if I use the ServerBridge function to create the bridge.
script A

local shooted = BridgeNet2.ServerBridge("shooted")
local function onAimStopped(player: Player)
        print("a")
	--smth
end
shooted:Connect(onAimStopped)

script A prints “a” when client fires this event, as expected

script B

local shooted = BridgeNet2.ServerBridge("shooted")
shooted:Connect(function(player: Player, args: {})
	print("b")
	--smth
end)

but script B doesn’t print anything

The same bridge is used in two different places, and in both cases the ServerBridge method is called, then the scripts connects to the bridge, but the signal only fires in the one who connected to the bridge faster. And if you replace the SeverBridge method with ReferenceBridge, then everything works fine.
script A and B is used for example, if needed i can show the source code

1 Like

I’ll look into this issue, can you send me a reproduction place file in DMs?