Skip to content

Links (Connections)

ILink is the core of the Void networking system. They define a connection between the player and server.

An ILink is created when a player connects to a server and destroyed when they disconnect. Switching to another server replaces the existing link with a new ILink. Players do not have an ILink during PlayerConnectingEvent or PlayerSearchServerEvent.

Channels are used to send or receive data from one side of the ILink. A separate INetworkChannel is created for IPlayer, and another for IServer.

ILink always has two channels that remain constant throughout the lifetime of the link: ILink.PlayerChannel and ILink.ServerChannel.

ILink saves references to both sides: ILink.Player and ILink.Server.

Void uses an internal implementation of ILink if not overridden by a plugin.

Plugins can override it by providing a custom implementation of ILink with CreateLinkEvent.

[Subscribe]
public void OnCreateLink(CreateLinkEvent @event)
{
@event.Result = new FasterLinkImplementation(@event.Player, @event.Server);
}

The job of an ILink implementation is to forward packets (messages) from the player channel to the server channel and vice versa. If you want to replace the default implementation, follow this example.