c# - Is there any way that Client responses Server in SignalR? -


my server side code:

var _identity = connectedusers.firstordefault(aa => aa.serverid == serverid); var rsp = clients.client(_identity.connectionid).rcvsendtouser(message); 

my client side code:

_hub = connection.createhubproxy("testhub"); connection.start().wait(); _hub.on("rcvsendtouser", x => console.writeline(x)); 

when client receives message, possible client response string value server side? if possible, how modify code on both?

one way add new method in server side hub , call client.

add method hub in server:

public void acknowledgeserver(string ack) {   // stuff. } 

and modify client code little bit:

_hub.on("rcvsendtouser", x => {   console.writeline(x);    // call server method string value.   _hub.invoke("acknowledgeserver", "your string server") }); 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -