Skip to content

YetAnotherNet v0.8.0

Compare
Choose a tag to compare
@YetAnotherClown YetAnotherClown released this 03 May 01:29
· 36 commits to main since this release

Effortless Buffer Compression

One of the key focuses for this version is the addition of Buffer Support and an internal Ser/Des library which will automatically compress the data sent into Buffers with minimal to no work required by the developer.

The library will now pack the data and compress it into a format that will be compressed even further by Roblox when sent over the network. The only limitation is that it doesn't work for all datatypes, the most common datatypes are supported already, so be sure to avoid any Unsupported Datatypes when using the library to ensure you get the most out of the compression.

Stability for the Public API

With this version, the core-functionality under the Net Namespace consisting of Route, createHook, and start will be considered complete. I am satisfied with the current state of the API and I am ready to commit to stability and backwards compatibility.

The new Unit Tests should remain the same for the Public API, requiring little to no changes, but more extensive tests will be added with time to ensure stability.

Unit Testing with Jest Lua

The Focus for v0.8.0

A focus of this version is on stability. This includes both API Stability as mentioned in the last section, and ensuring that the library is stable in production. To achieve this, my goal is to extensively test all parts of the library and any edge cases where it could fail.

The current tests will serve as a base to work off of and to ensure general functionality during development. I will be working on more tests with time and when I add new features or make changes to the library.

I encourage anyone willing to contribute to point out any errors with the library, or to suggest/write new tests that could improve on what we have. Create an Issue or PR to submit an idea for a test and do not be afraid to reach out to discuss it.

Why Jest?

It has been a goal to provide unit tests for the library, this was shown in v0.2.0 when I had a branch to implement Unit Tests using TestEZ.
Needless to say this branch was never merged into main, and it was eventually deleted in favor for the new tests using Jest Lua.

When I first used TestEZ, it wasn't that nice of an experience, so when I tried Jest Lua, I was pleasantly surprised by how nice the developer experience was and what I could achieve with it. There were lots of nice new features and great additions to developer experience such as Mocking, Strict Typing, and Auto-completion right out of the box.

I've used the Mocking feature to tackle some of the issues I had while trying to write unit tests with TestEZ, which has allowed me to mock the use of RemoteEvents to allow some simple and robust unit tests.

I look forward to continuing the use of Jest Lua with YetAnotherNet and in my other projects and games.


Installing the New Version

Wally

Add YetAnotherNet to your project with Wally by adding the following to your wally.toml file:

[dependencies]
Net = "yetanotherclown/yetanothernet@0.8.0"

Note

Wally does not export types automatically, if you wish to use Strict Typing with YetAnotherNet, install Wally Package Types with Foreman.

NPM for Roblox Typescript

You can find YetAnotherNet on NPM, or install it with the command line:

npm i @rbxts/yetanothernet@0.8.0

Change Log

Tip

See the new CHANGELOG.md for future and past changes.

Added

  • Unit tests with Jest
    • For Identifier
    • For SendRequest
    • For QueryResult
    • For Route
    • For Bridge
  • Bridge, Route, Player, and RemoteEvent Mocking
  • Script for Installing Wally and Exporting Wally Types
  • Script for running Jest tests using run-in-roblox
  • Warning for attempting to send an invalid string as a recipient
  • An Internal Ser/Des Library
  • Automatic Compression for the Bridge
  • Documentation for the Bridge

Changed

  • Updated Rojo to v7.4.0
  • Updated Jest-Lua to v0.6.1-rc.2
  • Migrate from Aftman to Foreman
  • SendRequest:to() no longer returns if called on the Client
  • Refactored Bridge to better allow for unit tests
  • Reduced the average call time of Route:send() by 50-60%
  • Documentation no longer references Compression with Middleware
  • Rewrote the Bridge to support Buffers
  • Refactored the Bridge to better support Mocking
  • Identifiers are now represented as Buffers instead of packed strings
  • Bridge:snapshot() now returns a frozen table instead of a cloned table

Fixed

  • QueryResult does not filter senders
  • Incorrect types for Incoming Middleware
  • Incorrect and inconsistent Roblox-TS Types
  • Default Channel is never applied when no configuration parameter was supplied
  • Outdated use of Net.start in Documentation
  • SendRequest:to() will show a client warning when using run-in-roblox
  • Incorrect Unit Test for Outgoing Middleware