Coder Social home page Coder Social logo

talkie's Introduction

Talkie

โš  This library is a work in progress! It's API surface may change significantly with updates and their may be bugs. Use at your own risk!

View on Wally

Talkie is an experimental networking library for Roblox.

Key Features

  • ๐Ÿƒ Bandwidth efficient - Have absurd amounts of remotes without any extra cost!
  • โ™ป Lightweight
  • ๐Ÿ—’ Luau typings
  • ๐Ÿ˜ Super friendly API surface
  • ๐Ÿง‘โ€๐Ÿ’ป Greatly extensible - pass your own filters!
  • ๐ŸŸฃ Integration with Promises

Samples

Chat Event

-- Client

local Talkie = require(somewhere.Talkie)
local ClientEvent = Talkie.ClientEvent

local messageEvent: Talkie.ClientEvent<string> = ClientEvent("send_message")

messageEvent:send("Hello world!")
-- Server

local Talkie = require(somewhere.Talkie)
local ServerEvent = Talkie.ServerEvent
local TypeGuard = Talkie.Util.TypeGuard

local messageEvent: Talkie.ServerEvent = ServerEvent("send_message")

messageEvent:subscribe(
    function(player, message)
        print(`[{player}]: {message}`)
    end,
    -- This utility will handle sanity checks for us!
    TypeGuard.new(TypeGuard.Any(), "string")
)

Spawn Character on Load

-- Client

local ContentProvider = game:GetService("ContentProvider")

local Talkie = require(somewhere.Talkie)
local ClientEvent = Talkie.ClientEvent

local loadEvent = ClientEvent("load_confirmation")

ContentProvider:PreloadAsync("rbxassetid://00000000", ...)
-- Tell the server we've loaded in
loadEvent:send()
-- Server

local Players = game:GetService("Players")

local Talkie = require(somewhere.Talkie)
local ServerEvent = Talkie.ServerEvent

local loadEvent = ServerEvent("load_confirmation")

local function onPlayerAdded(player: Player)
    loadEvent
        :expectFrom(player)
        :andThen(function()
            player:LoadCharacter()
        end)
        :timeout(30, "Timed out") -- Prevent the player from hanging the event forever!
        :catch(warn)
end

Players.PlayerAdded:Connect(onPlayerAdded)

for _, player in Players:GetPlayers() do
    onPlayerAdded(player)
end

talkie's People

Contributors

fizzyhex avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.