Struct ggrs::P2PSpectatorSession [−][src]
pub struct P2PSpectatorSession { /* fields omitted */ }
Expand description
A P2PSpectatorSession
provides a UDP protocol to connect to a remote host in a peer-to-peer fashion. The host will broadcast all confirmed inputs to this session.
This session can be used to spectate a session without contributing to the game input.
Implementations
Returns the current SessionState
of a session.
A spectator can directly start the session. Then, the synchronization process will begin.
Errors
- Returns
InvalidRequest
if the session has already been started.
You should call this to notify GGRS that you are ready to advance your gamestate by a single frame.
Returns an order-sensitive Vec<GGRSRequest>
. You should fulfill all requests in the exact order they are provided.
Failure to do so will cause panics later.
Errors
- Returns
NotSynchronized
if the session is not yet ready to accept input. In this case, you either need to start the session or wait for synchronization between clients.
Used to fetch some statistics about the quality of the network connection.
Errors
- Returns
NotSynchronized
if the session is not connected to other clients yet.
Returns all events that happened since last queried for events. If the number of stored events exceeds MAX_EVENT_QUEUE_SIZE
, the oldest events will be discarded.
Receive UDP packages, distribute them to corresponding UDP endpoints, handle all occurring events and send all outgoing UDP packages. Should be called periodically by your application to give GGRS a chance to do internal work like packet transmissions.