Forest Logo
search
package_2

fibre

By @minstrix

Roblox

Mirrored from Wally

This version ships no README. Showing the README from v0.2.1, mirrored from wally.

Fibre

Fibre is a Knit-inspired framework for server-client communication. If you've used Knit before, you will notice many similarities and a few key differences - namely in how services are added/retrieved.

DISCLAIMER: The following is temporary documentation. Proper docs will be produced once Fibre is in a more final state.

Installation


Currently you can install Fibre by directly adding the source files into your Rojo project or by downloading the latest .rbxm in releases. Wally is not currently supported but will be in the future.

Usage Example


In a server script:

local ServerStorage = game:GetService("ServerStorage")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Fibre = require(ReplicatedStorage.Fibre)
Fibre.AddChildren(ServerStorage.Services)
Fibre.Start(true)

print(Fibre.Server.Get("Capitalizer"):AllCaps("server")) --> "SERVER"

In a module script named Capitalizer in ServerStorage.Services:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Fibre = require(ReplicatedStorage.Fibre)

local Capitalizer = {}
Capitalizer.Client = {} -- for functions and RemoteSignals only!

function Capitalizer:Init()
    print("Init is called during Fibre.Start()!")
    Capitalizer.Client.MessageReceived = Fibre.RemoteSignal.new()
end

function Capitalizer:OnStart()
    print("OnStart is called after Fibre.Start()!")
end

function Capitalizer:AllCaps(s)
    return string.upper(s)
end

function Capitalizer.Client:AllCaps(player, s)
    self.Client.MessageReceived:FireClient(player, "Got your message!")
    return self:AllCaps(s)
end

return Capitalizer

In a client script:

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Fibre = require(ReplicatedStorage.Fibre)
Fibre.AddChildren(ReplicatedStorage.Services)
Fibre.Start(true)

print(Fibre.Client.Get("ClientCapitalizer"):AllCaps("client")) --> "CLIENT"

In a module script named ClientCapitalizer in ReplicatedStorage.Services:

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Fibre = require(ReplicatedStorage.Fibre)
local Capitalizer = Fibre.Server.Get("Capitalizer")

local ClientCapitalizer = {}

function ClientCapitalizer:Init()
    print("Init is called during Fibre.Start()!")
    Capitalizer.MessageReceived:Connect(function(msg)
        print(msg) --> "Got your message!" anytime Capitalizer:AllCaps() is called
    end)
end

function ClientCapitalizer:OnStart()
    print("OnStart is called after Fibre.Start()!")
end

function ClientCapitalizer:AllCaps(s)
    return Capitalizer:AllCaps(s)
end

return ClientCapitalizer

Full Output:

[FIBRE] Initializing Capitalizer  -  Server
Init is called during Fibre.Start()!  -  Server
[FIBRE] Creating Remotes for Capitalizer  -  Server
[FIBRE] Starting Capitalizer  -  Server
Start is called after Fibre.Start()!  -  Server
[FIBRE] Server Started!  -  Server
SERVER  -  Server
[FIBRE] Initializing ClientCapitalizer  -  Client
Init is called during Fibre.Start()!  -  Client
[FIBRE] Starting ClientCapitalizer  -  Client
Start is called after Fibre.Start()!  -  Client
[FIBRE] Client Started!  -  Client
Got your message!  -  Client
CLIENT  -  Client

Fibre API

Fibre.Add(Module: ModuleScript)

Requires a ModuleScript and adds it to Fibre. Must be called before Fibre.Start().

Fibre.AddChildren(Parent: Instance)

Calls Fibre.Add() on all children. Must be called before Fibre.Start().

Fibre.Server.Get(Service: string)

Returns a service from the server. Must be called after Fibre.Start() if being called from the server.

Fibre.Client.Get(Service: string)

Returns a service from the client. Must be called after Fibre.Start(). Can only be called from the client.

Fibre.Start(verbose: boolean)

Starts Fibre. If verbose is true a message will be printed for each service.

Signal & RemoteSignal

These are essentially just wrappers for BindableEvent and RemoteEvent respectively. Their API is super self explanatory, just take a quick look at their source code!

Package Details

Install command (Click to copy)


Version

0.3.1

License

MIT

check_circle

Safe for commercial use

infoThe package archive does not include its license text; the license is declared in its manifest metadata.

Automated license review — not legal advice.