Router
Simple and effective cross-server data transfer
GitHub | Releases | Documentation
What is it?
Router is an open-source object-oriented framework for cross-server messaging on Roblox. Above all, Router is designed to be simple and easy to use, abstracting away the low-level complexities of cross-server messaging. Router uses a custom-designed Cross-Server Routing Protocol to communicate between servers, which enables routing messages to specific servers and fragmentation of longer messages.
The Router library is written using strict type checking, which allows it to integrate seamlessly with Roblox Studio’s built-in code editor.
Advantages over the default MessagingService
Router is capable of sending and receiving messages that exceed MessagingService’s 1 kilobyte limit. This is achieved by fragmenting larger messages if necessary. Additionally, Router is able to filter messages to specific servers using the message format outlined in the Cross-Server Routing Protocol specification.
Message routing, fragmentation and reassembly is handled automatically by the Router library.
Examples
-- Send a message using Router
local router = Path.To.Router
local MessageStream = require(router.MessageStream)
local CsrpMessageBuilder = require(router.CsrpMessageBuilder)
local message = CsrpMessageBuilder.new()
:AddRecipient("d68fb296-854e-4811-901f-42ac40ece5c0")
:SetBody("This message body could exceed the MessagingService 1 kB limit")
:Build()
local stream = MessageStream.new("topic name")
stream:Send(message)
-- Receive a message with Router
local router = Path.To.Router
local MessageStream = require(router.MessageStream)
local stream = MessageStream.new("topic name")
stream:Subscribe(function(message)
print(message.Body)
end)
Getting started
Installation instructions and API reference can be found in the documentation.