Stormancer.Core.IScene Interface Reference

Represents a Stormancer scene. More...

Inherited by Stormancer.Scene.

Public Member Functions

Task Disconnect ()
 Disconnect from the scene. /// More...
 
void AddRoute (string routeName, Action< Packet< IScenePeer >> handler, MessageOriginFilter filter, Dictionary< string, string > metadata)
 Add a route to the scene. /// More...
 
void Send (PeerFilter peerFilter, string routeName, Action< Stream > writer, PacketPriority priority=PacketPriority.MEDIUM_PRIORITY, PacketReliability reliability=PacketReliability.RELIABLE_ORDERED, string channelIdentifier="")
 Send a packet to a route. /// More...
 
void Send (string routeName, Action< Stream > writer, PacketPriority priority=PacketPriority.MEDIUM_PRIORITY, PacketReliability reliability=PacketReliability.RELIABLE_ORDERED, string channelIdentifier="")
 Send a packet to a route. /// More...
 
ConnectionState GetCurrentConnectionState ()
 Returns the connection state to the the scene. /// More...
 
string GetHostMetadata (string key)
 Returns a host metadata value. More...
 
IObservable< Packet< IScenePeer > > OnMessage (string routeName, MessageOriginFilter filter, Dictionary< string, string > metadata)
 Creates an IObservable<Packet> instance that listen to events on the specified route. More...
 
P2PTunnel RegisterP2PServer (string p2pServerId)
 
Task< IP2PScenePeerOpenP2PConnection (string p2pToken, CancellationToken ct)
 
Task< IP2PScenePeerOpenP2PConnection (string p2pToken)
 
Dictionary< string, string > GetSceneMetadata ()
 

Properties

Subject< ConnectionStateCtxSceneConnectionStateObservable [get]
 
string Id [get]
 Returns the scene id. /// More...
 
IConnection HostConnection [get]
 Returns a host connection. More...
 
Route[] LocalRoutes [get]
 Returns a copy of the local routes. More...
 
Route[] RemoteRoutes [get]
 Returns a copy of the remote routes. More...
 
IScenePeer[] RemotePeers [get]
 Get an array containing the scene host connections. More...
 
IScenePeer Host [get]
 Returns the peer connection to the host. More...
 
IDependencyResolver DependencyResolver [get]
 
Action< PacketOnPacketReceived [get]
 Fire when a packet is received in the scene. More...
 
bool IsHost [get]
 True if the instance is an host. False if it's a client. More...
 

Detailed Description

Represents a Stormancer scene.

In a Stormancer application, users connect to scenes to interact with each other and the application. A scene has 2 faces: A scene host, currently only server side scene hosts are supported, and scene clients.

Member Function Documentation

◆ AddRoute()

void Stormancer.Core.IScene.AddRoute ( string  routeName,
Action< Packet< IScenePeer >>  handler,
MessageOriginFilter  filter,
Dictionary< string, string >  metadata 
)

Add a route to the scene. ///

Parameters
routeNameRoute name.
handlerFunction which handle the receiving messages from the server on the route.
metadataMetadatas about the Route.

Add a route for each different message type.

Implemented in Stormancer.Scene.

◆ Disconnect()

Task Stormancer.Core.IScene.Disconnect ( )

Disconnect from the scene. ///


Implemented in Stormancer.Scene.

◆ GetCurrentConnectionState()

ConnectionState Stormancer.Core.IScene.GetCurrentConnectionState ( )

Returns the connection state to the the scene. ///


Implemented in Stormancer.Scene.

◆ GetHostMetadata()

string Stormancer.Core.IScene.GetHostMetadata ( string  key)

Returns a host metadata value.

Implemented in Stormancer.Scene.

◆ OnMessage()

IObservable<Packet<IScenePeer> > Stormancer.Core.IScene.OnMessage ( string  routeName,
MessageOriginFilter  filter,
Dictionary< string, string >  metadata 
)

Creates an IObservable<Packet> instance that listen to events on the specified route.

<param "routeName">A string containing the name of the route to listen to.

Returns
An IObservable<Packet> instance that fires each time a message is received on the route.

Implemented in Stormancer.Scene.

◆ Send() [1/2]

void Stormancer.Core.IScene.Send ( PeerFilter  peerFilter,
string  routeName,
Action< Stream >  writer,
PacketPriority  priority = PacketPriority.MEDIUM_PRIORITY,
PacketReliability  reliability = PacketReliability.RELIABLE_ORDERED,
string  channelIdentifier = "" 
)

Send a packet to a route. ///

Parameters
peerFilterPeer receiver.
routeNameRoute name.
writerFunction where we write the data in the byte stream.
priorityMessage priority on the network.
reliabilityMessage reliability behavior.

Implemented in Stormancer.Scene.

◆ Send() [2/2]

void Stormancer.Core.IScene.Send ( string  routeName,
Action< Stream >  writer,
PacketPriority  priority = PacketPriority.MEDIUM_PRIORITY,
PacketReliability  reliability = PacketReliability.RELIABLE_ORDERED,
string  channelIdentifier = "" 
)

Send a packet to a route. ///

Parameters
routeNameRoute name.
writerFunction where we write the data in the byte stream.
priorityMessage priority on the network.
reliabilityMessage reliability behavior.

Implemented in Stormancer.Scene.

Property Documentation

◆ Host

IScenePeer Stormancer.Core.IScene.Host
get

Returns the peer connection to the host.

◆ HostConnection

IConnection Stormancer.Core.IScene.HostConnection
get

Returns a host connection.

◆ Id

string Stormancer.Core.IScene.Id
get

Returns the scene id. ///

◆ IsHost

bool Stormancer.Core.IScene.IsHost
get

True if the instance is an host. False if it's a client.

◆ LocalRoutes

Route [] Stormancer.Core.IScene.LocalRoutes
get

Returns a copy of the local routes.

◆ OnPacketReceived

Action<Packet> Stormancer.Core.IScene.OnPacketReceived
get

Fire when a packet is received in the scene.

◆ RemotePeers

IScenePeer [] Stormancer.Core.IScene.RemotePeers
get

Get an array containing the scene host connections.

Returns
An array containing the scene host connections.

◆ RemoteRoutes

Route [] Stormancer.Core.IScene.RemoteRoutes
get

Returns a copy of the remote routes.


The documentation for this interface was generated from the following file:
  • Stormancer.Core/IScene.cs