/// <summary> /// Authenticate the WAMP session to server. /// </summary> /// <param name="proxy">The proxy.</param> /// <param name="formatter">The formatter.</param> /// <param name="authKey">The key of the authentication credentials, something like a user or /// application name.</param> /// <param name="authExtra">Any extra authentication information.</param> /// <param name="authSecret">The secret of the authentication credentials, something like the user /// password or application secret key.</param> /// <returns>The WampCraPermissions.</returns> static WampCraPermissions Authenticate(IWampCraProcedures proxy, IWampFormatter<JToken> formatter, string authKey, IDictionary<string, string> authExtra, string authSecret) { string challenge = proxy.AuthReq(authKey, authExtra); if (string.IsNullOrEmpty(authKey)) { return proxy.Auth(null); } WampCraChallenge info = formatter.Deserialize<WampCraChallenge>(JObject.Parse(challenge)); string sig = WampCraHelpers.AuthSignature(challenge, authSecret, info.authextra); return proxy.Auth(sig); }
public void Error <TResult>(IWampFormatter <TResult> formatter, TResult details, string error) { mCaller.CallError(mRequestId, details, error); }
public void Result <TResult>(IWampFormatter <TResult> formatter, ResultDetails details, TResult[] arguments) { mCaller.Result(mRequestId, details, arguments.Cast <object>().ToArray()); }
private static IDictionary <string, object> DeserializeDictionary <TMessage>(TMessage details, IWampFormatter <TMessage> formatter) { return(formatter.Deserialize <IDictionary <string, object> >(details)); }
public void Event <TMessage>(IWampFormatter <TMessage> formatter, long publicationId, EventDetails details) { Console.WriteLine("received response with no arguments"); _callback(null); }
public IWampCancellableInvocation Invoke <TMessage>(IWampRawRpcOperationRouterCallback caller, IWampFormatter <TMessage> formatter, InvocationDetails details) { return(InvokePattern (operation => operation.Invoke(caller, formatter, details))); }
protected override IWampCancellableInvocation InnerInvoke <TMessage>(IWampRawRpcOperationRouterCallback caller, IWampFormatter <TMessage> formatter, InvocationDetails details, TMessage[] arguments, IDictionary <string, TMessage> argumentsKeywords) { CancellationTokenSourceInvocation result = null; CancellationToken token = CancellationToken.None; if (SupportsCancellation) { CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(); result = new CancellationTokenSourceInvocation(cancellationTokenSource); token = cancellationTokenSource.Token; } Task task = InnerInvokeAsync(caller, formatter, details, arguments, argumentsKeywords, token); return(result); }
public void Error <TMessage>(IWampFormatter <TMessage> formatter, TMessage details, string error, TMessage[] arguments, TMessage argumentsKeywords) { ErrorUri = error; }
public void Result <TMessage>(IWampFormatter <TMessage> formatter, ResultDetails details, TMessage[] arguments) { throw new NotImplementedException(); }
public IWampCancellableInvocation Invoke <TMessage>(IWampRawRpcOperationRouterCallback caller, IWampFormatter <TMessage> formatter, InvocationDetails details, TMessage[] arguments) { CancellableInvocation = new MyCancellableInvocation(); return(CancellableInvocation); }
public UnsubscribeRequest(IWampFormatter <TMessage> formatter, long subscriptionId) : base(formatter) { SubscriptionId = subscriptionId; }
public SubscribeRequest(IWampFormatter <TMessage> formatter, IWampRawTopicClientSubscriber subscriber, SubscribeOptions options, string topicUri) : base(subscriber, options, topicUri) { mPendingRequest = new WampPendingRequest <TMessage, IAsyncDisposable>(formatter); }
protected override object[] GetMethodParameters <TMessage>(IWampRawRpcOperationRouterCallback caller, CancellationToken cancellationToken, IWampFormatter <TMessage> formatter, TMessage[] arguments, IDictionary <string, TMessage> argumentsKeywords) { IEnumerable <object> parameters = UnpackParameters(formatter, arguments, argumentsKeywords); CallerProgress progress = new CallerProgress(caller, this); parameters = parameters.Concat(progress); if (SupportsCancellation) { parameters = parameters.Concat(cancellationToken); } object[] result = parameters.ToArray(); return(result); }
public IWampCancellableInvocation Invoke <TMessage>(IWampRawRpcOperationRouterCallback caller, IWampFormatter <TMessage> formatter, InvocationDetails details, TMessage[] arguments) { return(InnerInvoke(caller, formatter, details, arguments, null)); }
public void Setup() { mFormatter = new JsonFormatter(); }
protected abstract IWampCancellableInvocation InnerInvoke <TMessage> (IWampRawRpcOperationRouterCallback caller, IWampFormatter <TMessage> formatter, InvocationDetails details, TMessage[] arguments, IDictionary <string, TMessage> argumentsKeywords);
public void Result <TMessage>(IWampFormatter <TMessage> formatter, ResultDetails details, TMessage[] arguments, IDictionary <string, TMessage> argumentsKeywords) { throw new NotImplementedException(); }
protected abstract Task <object> InvokeAsync <TMessage> (IWampRawRpcOperationRouterCallback caller, IWampFormatter <TMessage> formatter, InvocationDetails details, TMessage[] arguments, IDictionary <string, TMessage> argumentsKeywords, CancellationToken cancellationToken);
public void Error <TMessage>(IWampFormatter <TMessage> formatter, TMessage details, string error) { throw new NotImplementedException(); }
protected override IWampCancellableInvocation InnerInvoke <TMessage>(IWampRawRpcOperationRouterCallback caller, IWampFormatter <TMessage> formatter, InvocationDetails options, TMessage[] arguments, IDictionary <string, TMessage> argumentsKeywords) { CancellationTokenSourceInvocation result = null; try { CancellationToken token = CancellationToken.None; if (SupportsCancellation) { CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(); result = new CancellationTokenSourceInvocation(cancellationTokenSource); token = cancellationTokenSource.Token; } Task <object> task = InvokeAsync(caller, formatter, options, arguments, argumentsKeywords, token); task.ContinueWith(x => TaskCallback(x, caller)); } catch (WampException ex) { mLogger.ErrorFormat(ex, "An error occured while calling {0}", this.Procedure); IWampErrorCallback callback = new WampRpcErrorCallback(caller); callback.Error(ex); } return(result); }
public void Error <TMessage>(IWampFormatter <TMessage> formatter, TMessage details, string error, TMessage[] arguments, TMessage argumentsKeywords) { throw new NotImplementedException(); }
public IWampCancellableInvocation Invoke <TMessage>(IWampRawRpcOperationRouterCallback caller, IWampFormatter <TMessage> formatter, InvocationDetails details, TMessage[] arguments, IDictionary <string, TMessage> argumentsKeywords) { return(InvokePattern (operation => operation.Invoke(caller, formatter, details, arguments, argumentsKeywords))); }
public IWampCancellableInvocation Invoke <TMessage>(IWampRawRpcOperationRouterCallback caller, IWampFormatter <TMessage> formatter, InvocationDetails details) { this.Details = details; return(null); }
public void Event <TMessage>(IWampFormatter <TMessage> formatter, long publicationId, EventDetails details, TMessage[] arguments) { _callback(arguments); }
public IWampCancellableInvocation Invoke <TMessage>(IWampRawRpcOperationRouterCallback caller, IWampFormatter <TMessage> formatter, InvocationDetails details, TMessage[] arguments, IDictionary <string, TMessage> argumentsKeywords) { this.Details = details; return(null); }
public void Result <TResult>(IWampFormatter <TResult> formatter, ResultDetails details) { mCaller.Result(mRequestId, details); }
public void Result <TMessage>(IWampFormatter <TMessage> formatter, ResultDetails details) { }
public void Result <TResult>(IWampFormatter <TResult> formatter, ResultDetails details, TResult[] arguments, IDictionary <string, TResult> argumentsKeywords) { mCaller.Result(mRequestId, details, arguments.Cast <object>().ToArray(), argumentsKeywords.ToDictionary(x => x.Key, x => (object)x.Value)); }
public void Result <TMessage>(IWampFormatter <TMessage> formatter, ResultDetails details, TMessage[] arguments) { }
public void Error <TResult>(IWampFormatter <TResult> formatter, TResult details, string error, TResult[] arguments) { mCaller.CallError(mRequestId, details, error, arguments.Cast <object>().ToArray()); }
public void Result <TMessage>(IWampFormatter <TMessage> formatter, ResultDetails details, TMessage[] arguments, IDictionary <string, TMessage> argumentsKeywords) { }
public void Error <TMessage>(IWampFormatter <TMessage> formatter, TMessage details, string error) { ErrorUri = error; }
public void Setup() { mFormatter = new JsonFormatter(); mMessageFormatter = new JsonWampMessageFormatter(); }