Skip to main content
Version: 3.2

interface INetworking

(Niantic.Lightship.SharedAR.Networking.INetworking)

Overview

Low level networking interface used by the LightshipNetcodeTransport to talk to the Lightship relay servers. This interface allows you to relay a message directly to another user, halfing the latency of Netcode For Gameobject messages which have to be double-relayed by the "Host" client.

    interface INetworking: IDisposable {
// properties

NetworkState NetworkState;
PeerID SelfPeerID;
List<PeerID> PeerIDs;

// events

event NetworkEvent();
event PeerAdded();
event PeerRemoved();
event DataReceived();

// methods

void SendData(List<PeerID> dest, uint tag, byte[] data);
void Join();
void Leave();
};

Detailed Documentation

Low level networking interface used by the LightshipNetcodeTransport to talk to the Lightship relay servers. This interface allows you to relay a message directly to another user, halfing the latency of Netcode For Gameobject messages which have to be double-relayed by the "Host" client.

Properties

NetworkState

NetworkState NetworkState

Get the latest connection state

SelfPeerID

PeerID SelfPeerID

This client's PeerID.

PeerIDs

List<PeerID> PeerIDs

Get all PeerIDs actively connected to the room.

Events

NetworkEvent

event NetworkEvent()

Event fired when the client's connection to the network changes state.

PeerAdded

event PeerAdded()

Event fired when a peer joins the room. All other clients in the room are considered "Peers" by this API.

PeerRemoved

event PeerRemoved()

Event fired when a peer is removed, either from intentional action, timeout, or error. All other clients in the room are considered "Peers" by this API.

DataReceived

event DataReceived()

Data received from another peer in the room sent through the SendData method.

Methods

SendData

void SendData(List<PeerID> dest, uint tag, byte[] data)

Send data to the specified peers. Receiving peers will have a DataReceived event fired. This function is used by LightshipNetcodeTransport to send all Netcode messages.     Parameters:     dest - Destination of the message. Passing an empty list will broadcast the message to all other peers in the room.     tag - Data tag that peers will receive     data - Byte[] to send

Join

void Join()

Establish the network connection configured by the network's construction. Calling "Join" on the Room automatically calls this method, consider using the Room API instead!

Leave

void Leave()

Disconnect from the room. Calling "Leave" on the Room automatically calls this method, consider using the Room API instead!