Skip to content

Net v0.6.0

Choose a tag to compare

@YetAnotherClown YetAnotherClown released this 14 Dec 17:31
· 125 commits to main since this release

Net v0.6.0

Net v0.6.0 is here with a new powerful feature called Middleware, and new and improved Documentation.

Updated Documentation

The Documentation for Net has been fully overhauled, with an exception of the API docs. This overhaul contains new and more detailed guides as well as a new homepage.

You can checkout the documentation here.

Middleware

Middleware allows you to validate types and serialize/deserialize data before it is processed when sending and receiving data.

To create Middleware, you can specify a function in your Route's Configuration with a parameter for the event "send" | "receive" and the data that is to be processed U....

local Net = require("Net.luau")
type Net<U...> = Net.Net<U...>

local Route: Net<number, string, boolean> = Net.new({
    Middleware = function(event, num, str, bool)
        -- Do something

        return num, str, bool
    end
})

To validate your types, you can return the values in order to allow it to be processed, or you can drop the packet by returning nil. Dropped packets will never reach your code, meaning you can ensure that the types your code receives are always the types you expect.

You can also serialize/deserialize data in Middleware, to see a full example read Getting Started with Middleware

Fixed

  • Incoming packets do not respect their channel