1

Before i make server in Windows form application . On Server Side using c# Code I can send message to specific Client From Server .the Code is here.

IHubContext context = GlobalHost.ConnectionManager.GetHubContext<MyHub>();



private void buttonClient_Click(object sender, EventArgs e)
        {
            string Clientid = comboBoxClients.SelectedItem.ToString();
// sendOrders(string,string) this method should make on client side with same name  and here call like thats . 
            context.Clients.Client(Clientid).sendOrders("Name","Message Server to you"); 

        }

But now I've make Server in asp.net Web application . Please tell me following question :

1) how can i send Message to Specific Client from Server?

2) How can i call Method of specific clients From Server Side ?

My Server Code is here :

 var chatHubProxy = $.connection.myChatHub;

// Send Message to Broadcast .
          $("#send").click(function () {
              chatHubProxy.server.broadcastMessage($("#name").val(), $("#msg").val());
          });



// Send Message to specific Client 

var clintdid=$('#dropdownClientID').val();

 $("#sendspecific").click(function () {
// Please update this line of code . 
              chatHubProxy.server.Client(clintdid).SendtoSpecific($("#name").val(), $("#msg").val());
          });
Adam
  • 173
  • 2
  • 14
  • possible duplicate of [Call specific client from SignalR](http://stackoverflow.com/questions/7872589/call-specific-client-from-signalr) – dariogriffo Jan 07 '15 at 16:57
  • 1
    Its confusing.. you are saying `send messge from server using javascript` where `javascript` will run on client side. if you want to send message from one client to another client then you can send message from one client to SignalR hub with specific parameter ie. another client's id. then hub will find the client from given client id and send the message to that client. – Shell Jan 08 '15 at 04:06
  • I'm saying send message from server using java-script to other console application application client . i don't want send message from one client to another client. its server(java script) ==> client(console). – Adam Jan 12 '15 at 14:55

0 Answers0