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());
});