signalr - Client side event is not calling for " Clients.Group(groupName).MessageReceived(UserName, message, groupName); " -


hub class

public void sendtoall(string username,string message,string grpid,string groupname,string userid)

{

if (grpid == "3")         {             //this working             clients.all.messagereceived(username, message, groupname);         }         if (grpid == "4")          { //this not working              clients.group(groupname).messagereceived(username,message,groupname);         } 

}

client side:

        $('#btnsendtoall').click(function () {             var grpid = $(this).parent().attr('groupid');             var grpname = $(this).parent().attr('groupname1');             chat.server.sendtoall($("#hdnusername").val(), $('#txtmsg').val(), grpid, grpname, $("#hdnuserid").val());             $('#dvgroupchat', $(this).parent()).find('ul').append($('#txtmsg').val());             $('#message').val('').focus();         });          chat.client.messagereceived = function (name, message, grouptype) {             $('div[groupname1=' + grouptype + ']').find('ul').append('<ul>' + name + ':&nbsp;&nbsp;' + message + '');         }; 


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

how to prompt save As Box in Excel Interlop c# MVC 4 -

xslt 1.0 - How to access or retrieve mets content of an item from another item? -