title: How to reference/return a value from SignalR?
body: <p>This is the code I have:</p>
  
  <pre><code>from signalr_aio import Connection
  
  if __name__ == "__main__":
      # Create connection
      # Users can optionally pass a session object to the client, e.g a cfscrape session to bypass cloudflare.
  
      connection = Connection('https://beta.bittrex.com/signalr', session=None)
      hub = connection.register_hub('c2')
  
      hub.server.invoke('GetAuthContext', API_KEY)               #Invoke 0 Creates the challenge that needs to be signed by the create_signature coroutine
      signature = await create_signature(API_SECRET, challenge)  #Creates the signature that needs to authenticated in the Authenticate query
      hub.server.invoke('Authenticate', API_KEY, signature)      #Invoke 1 authenticates user to account level information
  
      connection.start()
  </code></pre>
  
  <p>What I have to do is verify my identity by getting a string-type challenge by the <code>GetAuthContext</code> call, then create a string-type signature using that challenge, and then pass that signature to the <code>Authenticate</code>call. The problem I'm having is that that I need to enter the return value of the <code>GetAuthContext</code> into the challenge parameter of the <code>create_signature</code> coroutine. I'm guessing from the comment next to the below example that every invoke method gets marked as <code>I([index of method])</code>, so I would have to do <code>signature = await create_signature(API_SECRET, 'I(0)')</code></p>
  
  <pre><code>async def on_debug(**msg):
      # In case of `queryExchangeState` or `GetAuthContext`
      if 'R' in msg and type(msg['R']) is not bool:
           # For the simplicity of the example I(1) corresponds to `Authenticate` and I(0) to `GetAuthContext`
           # Check the main body for more info.
           if msg['I'] == str(2):
              decoded_msg = await process_message(msg['R'])
              print(decoded_msg)
          elif msg['I'] == str(3):
              signature = await create_signature(API_SECRET, msg['R'])
              hub.server.invoke('Authenticate', API_KEY, signature)
  </code></pre>
  
  <p>Later this example gets assigned to connection.received ( <code>connection.received += on_debug</code> ) so I'm guessing that after <code>connection.start()</code> I have to put <code>connection.recieved()</code> to call the on_debug coroutine which will verify me, but for now I just want to understand how to reference the .invoke() methods to use within a function or coroutine.</p>