How to call a Hub Method

Steps to call a Hub method

  1. First add the URL for the SignalR service.  (See steps 1- 3 of the Getting Started)
  2. In the project tree, double click on a method (or Right click a method --> Select Open) to open the request editor in its tab. In the screenshot below, we open a method named "register"
  3. Edit the request.  Tresi provides a simple and compact syntax for entering a signalR request.  For example, the register method below takes a single complex parameter of type User (C# code shown below)



    The structure of the User class is shown below.  It has several properties and one of the property (Address) is also a class



    The Tresi request that matches the above class structure is shown below



    Note the special variable called "input".  This variable is used to create an instance of any type of object by calling its Create method

     
  4. Now that the request already matches the structure of the User class, click on the Send button (or press F5) to invoke the Hub method.  Since the register method simply returns any argument it receives (see the signature of the method in step #3 above), we get back the request in JSON format - shown below

    Since the hub method we just called simply returns its input parameter, we can see that the JSON response matches exactly the request we've created in the editor

     


Site Map | Printable View | © 2008 - 2024 WCFStorm Solutions

Powered by mojoPortal | XHTML 1.0 | CSS | Design by styleshout