private Task <WapMessage> MethodCallHandler(ReceivedWapMessage receivedWapMessage) { if (!_methods.HasMethod(receivedWapMessage.EndPoint)) { var mres = MethodResult <Empty> .FromError("Method not found in this endpoint!"); var msg = new WapMessage <MethodResult <Empty> >(MessageType.MethodResponse, receivedWapMessage.EndPoint, mres); return(Task.FromResult <WapMessage>(msg)); } return(_methods.CallMethod(WapEndPoint.Parse(receivedWapMessage.EndPoint), receivedWapMessage)); }
public Task <MethodResult <MethodInfo> > GetMethodInfo(ClientConnection clt, Payloads.Generic.String ep) { if (!_clientMethods.ContainsKey(ep.Value)) { return(Task.FromResult(MethodResult <MethodInfo> .FromError("Method endpoint unknown"))); } return(Task.FromResult(MethodResult <MethodInfo> .FromResult(new MethodInfo() { EndPoint = ep.Value, ParamPayloadType = _clientMethods[ep.Value].ParamPayloadType, ResultPayloadType = _clientMethods[ep.Value].ResultPayloadType } ))); }
public Task <MethodResult <StringList> > GetEventPublishers(ClientConnection clt, Payloads.Generic.String ep) { StringList sl = new StringList(); if (!_events.ContainsKey(ep.Value)) { return(Task.FromResult(MethodResult <StringList> .FromError("Event EndPoint unknown"))); } foreach (ClientConnection connection in _events[ep.Value].Publishers) { sl.List.Add(connection.EndPoint.ToString()); } return(Task.FromResult(MethodResult <StringList> .FromResult(sl))); }
private Task <MethodResult <Empty> > GetEmptyErrorMessage(string error) { return(Task.FromResult(MethodResult <Empty> .FromError(error))); }