@Override
	public void Invoke(final String method, JSONArray args,
			HubInvokeCallback callback) {

		if (method == null)
        {
            throw new IllegalArgumentException("method");
        }

        if (args == null)
        {
            throw new IllegalArgumentException("args");
        }

        final String callbackId = mConnection.RegisterCallback(callback);

        HubInvocation hubData = new HubInvocation(mHubName, method, args, callbackId);

        String value = hubData.Serialize();

        mConnection.Send(value, new SendCallback() 
        {
			@Override
			public void OnSent(CharSequence messageSent) {
				Log.v(TAG, "Invoke of " + method + "sent to " + mHubName);
				// callback.OnSent() ??!?!?
			}

			@Override
			public void OnError(Exception ex) {
				// TODO Cancel the callback
				Log.e(TAG, "Failed to invoke " + method + "on " + mHubName);
				mConnection.RemoveCallback(callbackId);
				// callback.OnError() ?!?!?
			}
        });
    }
@ Override public void Invoke ( final String method , JSONArray args , HubInvokeCallback callback ) { if ( method == null ) { throw new IllegalArgumentException ( "method" ) ; } if ( args == null ) { throw new IllegalArgumentException ( "args" ) ; } final String callbackId = mConnection . RegisterCallback ( callback ) ; HubInvocation hubData = new HubInvocation ( mHubName , method , args , callbackId ) ; String value = hubData . Serialize ( ) ; mConnection . Send ( value , new SendCallback ( ) { @ Override public void OnSent ( CharSequence messageSent ) { Log . v ( TAG , "Invoke of " + method + "sent to " + mHubName ) ; } @ Override public void OnError ( Exception ex ) { Log . e ( TAG , "Failed to invoke " + method + "on " + mHubName ) ; mConnection . RemoveCallback ( callbackId ) ; } } ) ; }
Executes a method on the server asynchronously