> For the complete documentation index, see [llms.txt](https://jen-hsuan-hsieh.gitbook.io/asp-net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jen-hsuan-hsieh.gitbook.io/asp-net/chapter2signalr/22basic-of-signalr/224create-a-server-method-and-calling-from-client.md).

# 2.2.4.Create A server method and calling from client

* 1.Add a simple method in App\_Code\MyHub.cs

```
[HubName("myhub")]
public class MyHub:Hub
{
    public string serverMethod()
    {
        return "serverMethod";
    }
    public MyHub()
    {
        //
        // TODO: Add constructor logic here
        //
    }
}
```

* 2.bind server method to client

```
<script>
    $(document).ready(function () {
        var obj = $.connection.myhub;
        $.connection.hub.start().done(function () {
            obj.server.serverMethod();
        }).fail(function () {
            alert("No Connected");
        });
});
</script>
```

* 3.Add a break point to server method and execute the connection
  * It will pause at the break point&#x20;
