// start listening to a route public void OnRoute <T>(string route, Action <T> action) { _typePushSubscriber.Subscribe(route, typeof(T)); Action <object> responseAction = res => { action((T)res); }; _eventManager.AddOnRouteEvent(route, responseAction); }
public void Request <T>(string route, IMessage msg, int timeout, Action <T> action, Action <PitayaError> errorAction) { _reqUid++; _typeRequestSubscriber.Subscribe(_reqUid, typeof(T)); Action <object> responseAction = res => { action((T)res); }; _eventManager.AddCallBack(_reqUid, responseAction, errorAction); var serializer = PitayaBinding.ClientSerializer(_client); PitayaBinding.Request(_client, route, ProtobufSerializer.Encode(msg, serializer), _reqUid, timeout); }