JavaEar 专注于收集分享传播有价值的技术资料

Sending a message to specific client using SignalR in java

I can broadcast messages through hub, I can get the connection id, but the issue is sending a message to specific client/connection, any sort of reading/help/anything will be highly appreciated.

I just need a quick response plus help on how to send a message to specific client as a client from java, for instance I am connected c# back end and I have connected to the hub, now I want to instruct the hub in java that, the message I am sending you is to send to a specific client. How to do it ???

1个回答

    最佳答案
  1. As described in the documentation on the server you can use either:

    • Clients.Client(connectionId) if you have connection id
    • Clients.User(userId) if you have user id

    If you need to send a message from the client to a different client you need to invoke a server method and pass the target connection id/user id and invoke the method on a target client from the server using the provided id.