OperationDispatcher problem

Options
oman
oman
edited June 2012 in Photon Server
I use operationDispatcher to deal with the client operations, but it doesn't work. some source code as belows:

private static readonly OperationMethodInfoCache _OperationMethodInfoCache = new OperationMethodInfoCache();

private readonly OperationDispatcher _OperationDispatcher;

in the peer's constructor,
public IncomingClientPeer(IRpcProtocol rpcProtocol, IPhotonPeer nativePeer)
:base(rpcProtocol,nativePeer)
{
_OperationMethodInfoCache.RegisterOperations(typeof(IncomingClientPeer));

_OperationDispatcher = new OperationDispatcher(_OperationMethodInfoCache, this);

SetCurrentOperationHandler(this);
}

in the OnOperationRequest method is:
OperationResponse result;
if (_OperationDispatcher.DispatchOperationRequest(peer, operationRequest,sendParameters, out result))
{
return result;
}
here the DispatchOperationRequest return false.

and the operation process method is:
[Operation(OperationCode = (byte)OperationCode.SubscribeCounter)]
private OperationResponse OnOperationSubscribeCounter(Peer peer, OperationRequest operationRequest/*, SendParameters sendParameters*/)
{
..........................
}

what's the problem?

Comments

  • BenStahl
    Options
    Currently the RegisterOperation method of the OperationMethodInfoCache class only public instance methods will be registered.
    We will changed this in the next release to also support private and static methods.

    For now you have to change your operation methods to public.
    Thanks for pointing this out.