
SocketPlugin
A Figura Addon that allows TCP sockets and more.
About this Mod
VERY WORK-IN-PROGRESS
A figura addon that allows you to open and use TCP sockets.
You can contact me at ktzukii on Discord if the mod crashes your game, or doesn't work as intended.
(please attach the logs on the message, if not you're getting a "invalid, read description")
Documentation:
SocketAPI (global socket)
These functions WILL return nil if the client (game) running the avatar (your scripts and model) is not the host (eg. your game will return a LuaSocket instance, others will return nil.)
So please add host checks on your socket scripts, otherwise your avatar will error on other clients, and will cause unneccesary trouble and confusion.
SocketAPI:newSocket(String host, Number port) -> LuaSocket
Opens a new socket, will print errors in log or throw vm error.
SocketAPI:newWebsocket(String host, Number port) -> LuaWebsocket
Opens a new websocket, will print errors in log or throw vm error.
SocketAPI:closeAllSocket()
Close all sockets on the current avatar
SocketAPI:closeAllWebsocket()
Close all websockets on the current avatar
SocketAPI:closeAll() -> nil
Closes all sockets and/or websockets on the current avatar
LuaSocket
LuaSocket:send(String data) -> nil
Sends data, limited to strings due to how I wrote this mod. (working on changing that)
LuaSocket:recv() -> string
Recieves data, also limited to strings. (see above)
LuaSocket:hasData() -> boolean
Gets whether or not there is a message to be received, which can then be gotten by LuaSocket:recv()
Luasocket:close() -> nil
Sockets close automatically on avatar destroy/reload, but it's not a clean close, which is what this is for.
LuaWebsocket
Websockets are known to be buggy at this time.
LuaWebsocket:send(String data) -> nil
Sends data, limited to strings due to my understanding of Java.
LuaWebsocket:recv() -> string
Recieves data, also limited to strings. (see above)
LuaWebsocket:hasData() -> boolean
Gets whether or not there is a message to be received, which can then be gotten by LuaWebsocket:recv()
LuaWebsocket:close(String reason) -> nil
Websockets close automatically on avatar destroy/reload, but it's not a clean close, which is what this is for.
Examples:
REMOVED: My examples suck :3
I'll try to add some examples on the github wiki, but no promises.
Available Versions
How to Install SocketPlugin on Your Server
Order Server
Order a Minecraft Java server with at least 3 GB RAM (4 GB recommended).
Set fabric Loader
In the panel under "Egg", select the fabric loader and matching Minecraft version (1.21.4).
Install Mod
Open the mod browser in the dashboard and search for "SocketPlugin". Click "Install" – done! Alternatively, upload the .jar via SFTP to the /mods folder.
Compatibility
Mod Loaders
Minecraft Versions
1.21.4, 1.21.3, 1.21.2 (+4 more)
Server-side
✗ UnsupportedRecommended RAM
4 GB(min. 3 GB)Frequently Asked Questions
SocketPlugin server crashes on startup – what to do?
Most common cause: wrong fabric version or insufficient RAM. Check the server log (latest.log) for "OutOfMemoryError" or "Mixin" errors. With Mado Hosting: ensure at least 3 GB RAM is allocated and the loader matches the mod version (1.21.4). You can switch loaders with one click in the panel.
Is SocketPlugin compatible with fabric?
SocketPlugin officially supports fabric for Minecraft 1.21.4, 1.21.3, 1.21.2. The Mado dashboard automatically detects incompatible loader combinations.
Server lagging with SocketPlugin – how to optimize performance?
Recommended RAM: 4 GB (per 8 players). Use /spark profiler to check if SocketPlugin consumes the most tick time. Common fixes: reduce server view-distance to 8-10, install "performant" or "starlight" as supplementary mods on Forge. With Mado Hosting, your server runs on NVMe SSDs with dedicated CPU cores for minimal latency.
Similar Mods
Rent Modded Server
Install SocketPlugin with just one click on your server.