> 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/23-exploring-the-class-hub-and-group-chat/234-add-or-remove-connection-from-groups.md).

# 2.3.4. Add Or Remove Connection From Groups

* 1.Create a join method in hub:

  ```
        public void join(string group)
        {
            //join group
            Groups.Add(Context.ConnectionId, group);
            //remove group
            //Groups.Remove(Context.ConnectionId, group);
        }
  ```
* 2.Call join method in client side:

  ```
                    $.connection.hub.start().done(function () {
                        obj.server.join(g);
                        $("#send").click(function () {
                            obj.server.servermethod($("#name").html(), $("#msg").val());
                            console.log($("#msg").val());
                     });
  ```
