Skip to content
This repository has been archived by the owner on May 16, 2022. It is now read-only.

PhotonWire.Server

neuecc edited this page May 30, 2016 · 1 revision

CustomErrorException

public class PhotonWire.Server.CustomErrorException
    : Exception, ISerializable, _Exception

Properties

Type Name Summary
String ErrorMessage Return message to client.
Object Parameter Return parameter, only photon supported type.
Int16 ReturnCode Receiving returnCode. Code must not be 0 or -1.

DictionaryItemsExtensions

public static class PhotonWire.Server.DictionaryItemsExtensions

Static Methods

Type Name Summary
T GetValueOrDefault(this IDictionary<Object, Object> items, Object key, T defaultValue = null)

Hub

Hub is operation proxy of ClientPeer.

public abstract class PhotonWire.Server.Hub
    : Hub<INoClient>, IHub, IPhotonWireHub

Hub<T>

Hub is operation proxy of ClientPeer.

public abstract class PhotonWire.Server.Hub<T>
    : IHub, IPhotonWireHub

Properties

Type Name Summary
HubCallerClientProxy<T> Clients Client Proxy of peers.
OperationContext Context

Methods

Type Name Summary
ServerHubClientProxy<TServerHub> GetServerHubProxy()

HubAttribute

public class PhotonWire.Server.HubAttribute
    : Attribute, _Attribute

Properties

Type Name Summary
Int16 HubId

HubCallerClientProxy<T>

public class PhotonWire.Server.HubCallerClientProxy<T>
    : HubClientProxy<T>

Properties

Type Name Summary
T Caller Broadcast to caller client.
T Others Broadcast to all(in current gameserver) except caller client.

HubClientProxy<T>

public class PhotonWire.Server.HubClientProxy<T>

Fields

Type Name Summary
HubContext context

Properties

Type Name Summary
T All Broadcast to all(in current gameserver) client.

Methods

Type Name Summary
T AllExcept(IPhotonWirePeer[] excludePeers) Broadcast to all(in current gameserver) except exclude peers.
T Group(String groupName, IPhotonWirePeer[] excludePeers) Broadcast to target group(in current gameserver) except exclude peers.
T Groups(IList<String> groupNames, IPhotonWirePeer[] excludePeers) Broadcast to target groups(in current gameserver) except exclude peers.
T OthersInGroup(String groupName) Broadcast to all(in current gameserver) except exclude group.
T OthersInGroups(IEnumerable<String> groupNames) Broadcast to all(in current gameserver) except exclude groups.
T Target(IPhotonWirePeer peer) Broadcast to target(in current gameserver) client.
T Targets(IEnumerable<IPhotonWirePeer> peers) Broadcast to target(in current gameserver) clients.

HubContext

public class PhotonWire.Server.HubContext

Properties

Type Name Summary
HubDescriptor Hub
SendParameters SendParameters

Methods

Type Name Summary
void BroadcastEvent(IEnumerable<IPhotonWirePeer> targetPeers, Byte eventCode, Object[] args)
HubClientProxy<T> GetClientProxy()

HubContext<TClient>

public class PhotonWire.Server.HubContext<TClient>
    : HubContext

Properties

Type Name Summary
HubClientProxy<TClient> Clients

HubDescriptor

public class PhotonWire.Server.HubDescriptor

Properties

Type Name Summary
Boolean CanExecute
Type ClientType
Int16 HubId
HubKind HubKind
String HubName
ReadOnlyHashSet<String> HubTags
Type HubType

Methods

Type Name Summary
String[] GetRegisteredMethods()
Boolean TryGetMethod(Byte operationCode, MethodDescriptor& methodDescriptor)

Static Methods

Type Name Summary
HubDescriptor CreateIfPossible(Type type)

HubTag

public class PhotonWire.Server.HubTag
    : Attribute, _Attribute

Properties

Type Name Summary
IReadOnlyCollection<String> Tags

IgnoreClientGenerateAttribute

public class PhotonWire.Server.IgnoreClientGenerateAttribute
    : Attribute, _Attribute

IgnoreOperationAttribute

Indicated cless or method don't register and don't generate in PhotonWire engine.

public class PhotonWire.Server.IgnoreOperationAttribute
    : Attribute, _Attribute

IHub

public interface PhotonWire.Server.IHub
    : IPhotonWireHub

INoClient

Marker of No Client.

public interface PhotonWire.Server.INoClient

IPhotonSerializer

public interface PhotonWire.Server.IPhotonSerializer

Methods

Type Name Summary
Object Deserialize(Type type, Object value)
Object Serialize(Object obj)

IPhotonWireHub

Common interface for ClientHub(Hub), ServerHub, ReceiveServerHub

public interface PhotonWire.Server.IPhotonWireHub

Properties

Type Name Summary
OperationContext Context Context per operation.

IPhotonWirePeer

public interface PhotonWire.Server.IPhotonWirePeer

Properties

Type Name Summary
Int32 ConnectionId
ConcurrentDictionary<Object, Object> Items Property storage per connection.
PeerBase PeerBase
PeerKind PeerKind

Methods

Type Name Summary
IDisposable RegisterDisconnectAction(Action<Int32, String> disconnectAction) Action = DisconnectReason reasonCode, string reasonDetail
SendResult SendOperationResponse(OperationResponse operationResponse, SendParameters sendParameters)

IS2SPhotonWirePeer

public interface PhotonWire.Server.IS2SPhotonWirePeer
    : IPhotonWirePeer

Methods

Type Name Summary
Task<OperationResponse> SendOperationRequestAsync(Byte operationCode, Dictionary<Byte, Object> parameters, SendParameters sendParameters)

MethodDescriptor

public class PhotonWire.Server.MethodDescriptor

Properties

Type Name Summary
ParameterInfoSlim[] Arguments
ILookup<Type, Attribute> AttributeLookup
HubDescriptor Hub
String MethodName
Byte OperationCode
IReadOnlyList<String> ParameterNames
Type ReturnType

Methods

Type Name Summary
Task<Object> Execute(OperationContext context)

OperationAttribute

public class PhotonWire.Server.OperationAttribute
    : Attribute, _Attribute

Properties

Type Name Summary
Byte OperationCode

OperationContext

Encapsulates all information about an individual Photon request.

public class PhotonWire.Server.OperationContext

Properties

Type Name Summary
HubDescriptor Hub Info of belongs to Hub.
IDictionary<Object, Object> Items Property storage per operation.
MethodDescriptor Method Info of belongs to Method.
OperationRequest OperationRequest PhotonPeer's raw argument of OperationRequest.
IReadOnlyList<Object> Parameters Parameter values of method.
IPhotonWirePeer Peer Peer of caller.
SendParameters SendParameters PhotonPeer's raw argument of SendParameters.
DateTime Timestamp Initial timestamp of the current Photon request.

Methods

Type Name Summary
void SendOperation(Int32 messageId, Object result, String debugMessage, Boolean isError, IPhotonSerializer serializer, Nullable<Int16> returnCode)

ParameterInfoSlim

public class PhotonWire.Server.ParameterInfoSlim

Properties

Type Name Summary
Object DefaultValue
Boolean IsOptional
String Name
Type ParameterType
Boolean ParameterTypeIsArray
Boolean ParameterTypeIsClass
Boolean ParameterTypeIsNullable

PeerKind

public enum PhotonWire.Server.PeerKind
    : Enum, IComparable, IFormattable, IConvertible

Enum

Value Name Summary
0 Inbound
1 Outbound
2 Client

PeerManager

Managing Peer and Peer Groups.

public class PhotonWire.Server.PeerManager

Methods

Type Name Summary
void Add(IPhotonWirePeer peer)
void AddGroup(String groupName, IPhotonWirePeer peer)
ImmutableHashSet<IPhotonWirePeer> GetAll()
IPhotonWirePeer GetByConnectionId(Int32 connectionId)
ImmutableHashSet<IPhotonWirePeer> GetExceptOne(IPhotonWirePeer peer)
ImmutableHashSet<IPhotonWirePeer> GetExceptPeers(IEnumerable<IPhotonWirePeer> peers)
ImmutableHashSet<IPhotonWirePeer> GetGroup(String groupName)
void Remove(IPhotonWirePeer peer)
void RemoveGroup(String groupName, IPhotonWirePeer peer)
void RemoveGroupAll(String groupName)

Static Properties

Type Name Summary
PeerManager ClientConnections
PeerManager InboundServerConnections
PeerManager OutboundServerConnections

Static Methods

Type Name Summary
HubClientProxy<TClient> GetHubClient()
HubClientProxy<TClient> GetHubClient(SendParameters sendParameters)
HubContext GetHubContext()
HubContext GetHubContext(SendParameters sendParameters)
HubContext<TClient> GetHubContext()
HubContext<TClient> GetHubContext(SendParameters sendParameters)
PeerManager GetPeerManager(PeerKind peerKind)
ServerHubContext<THub> GetReceiveServerHubContext()
ServerHubContext<THub> GetReceiveServerHubContext(SendParameters sendParameters)
ServerHubContext<THub> GetServerHubContext()
ServerHubContext<THub> GetServerHubContext(SendParameters sendParameters)

PhotonSerializerBase

public abstract class PhotonWire.Server.PhotonSerializerBase
    : IPhotonSerializer

Methods

Type Name Summary
Object Deserialize(Type type, Object value)
Object DeserializeCore(Type type, Byte[] value)
Object Serialize(Object obj)
Byte[] SerializeCore(Object obj)

PhotonSerializers

public static class PhotonWire.Server.PhotonSerializers

Static Properties

Type Name Summary
IPhotonSerializer Json
IPhotonSerializer MsgPack

PhotonWireApplicationBase

Application Startup for PhotonWire.

public abstract class PhotonWire.Server.PhotonWireApplicationBase
    : ApplicationBase, IPhotonApplication, IPhotonControl

Properties

Type Name Summary
Nullable<TimeSpan> DisconnectAllPeersAfterOnRequestStopped If use graceful-restart(EnableShadowCopy/EnableAutoRestart), AppDomain keep alived. This timestpan force disconnect for start to TearDown.
Assembly[] HubTargetAssemlies
String[] HubTargetTags
Boolean IsDebugMode If true, 1. return exception message return to client when operation failed. 2. broadcast JSON(dumpable) message when from PhotonWire.HubInvoker. 3. show Debug.Fail dialog if failed on initialization
IPhotonWireLogger Logger
IPhotonSerializer Serializer

Methods

Type Name Summary
Task<PhotonWireOutboundS2SPeer> ConnectToOutboundServerAsync(IPEndPoint ipEndPoint, String applicationName, String groupName = null, Object customInitObject = null, Boolean useMux = False, Nullable<Int64> reconnectIntervalMs = 1000, Action<PhotonWireOutboundS2SPeer> onReconnected = null)
PeerBase CreatePeer(InitRequest initRequest)
Boolean IsServerToServerPeer(InitRequest initRequest)
void OnPeerCreated(IPhotonWirePeer peer, InitRequest initRequest, Boolean isServerToServerPeer)
void OnStopRequested()
void OnStopRequestedCore()
void Setup()
void SetupCore()
void TearDown()
void TearDownCore()

Static Properties

Type Name Summary
PhotonWireApplicationBase Instance

Static Methods

Type Name Summary
Task<PhotonWireOutboundS2SPeer> ConnectToOutboundServerAsync(PhotonWireApplicationBase applicationBase, IPEndPoint ipEndPoint, String applicationName, String groupName = null, Object customInitObject = null, Boolean useMux = False, Nullable<Int64> reconnectIntervalMs = 1000, Action<PhotonWireOutboundS2SPeer> onReconnected = null)

PhotonWireClientPeer

public class PhotonWire.Server.PhotonWireClientPeer
    : ClientPeer, IDisposable, IManagedPeer, IPhotonWirePeer

Properties

Type Name Summary
ConcurrentDictionary<Object, Object> Items Property storage per connection.
PeerBase PeerBase
PeerKind PeerKind

Methods

Type Name Summary
void OnDisconnect(DisconnectReason reasonCode, String reasonDetail)
void OnOperationRequest(OperationRequest operationRequest, SendParameters sendParameters)
IDisposable RegisterDisconnectAction(Action<Int32, String> action)

PhotonWireFilterAttribute

public abstract class PhotonWire.Server.PhotonWireFilterAttribute
    : Attribute, _Attribute

Properties

Type Name Summary
Int32 Order

Methods

Type Name Summary
Task<Object> Invoke(OperationContext context, Func<Task<Object>> next)

PhotonWirePeerExtensions

public static class PhotonWire.Server.PhotonWirePeerExtensions

Static Methods

Type Name Summary
void AddGroup(this IPhotonWirePeer peer, String groupName)
void RemoveGroup(this IPhotonWirePeer peer, String groupName)

ReservedParameterNo

public static class PhotonWire.Server.ReservedParameterNo

Static Fields

Type Name Summary
Byte MessageId Key for Int MessageId
Byte RequestHubId Key for short Request HubId
Byte ResponseId Key for Byte[] Response Result

TypedClientBuilder<T>

public class PhotonWire.Server.TypedClientBuilder<T>

Static Methods

Type Name Summary
T Build(HubContext context, IEnumerable<IPhotonWirePeer> targetPeers)