Skip to content

Links (Connections)

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

Instance of ILink is created whenever a player finds a server to connect to.
Players do not have any ILink at PlayerConnectingEvent event or PlayerSearchServerEvent event.

It is disposed when the player disconnects from the server.
However, the player might be just redirecting to another server, so new ILink will be created for each server connection player makes.

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

ILink always has 2 channels that never change in whole lifetime of the link: ILink.PlayerChannel and ILink.ServerChannel.

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

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

Plugin can override it by providing custom implementation of ILink with CreateLinkEvent event.

[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.