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 + ': ' + message + ''); };
Comments
Post a Comment