SignalR - Set ClientID Manually

前端 未结 3 991
萌比男神i
萌比男神i 2021-02-02 13:27

I want to be able to have individual users send messages to each other using SignalR, therefore I need to send to a Specific Client ID. How can I define the client ID for a spec

3条回答
  •  忘掉有多难
    2021-02-02 14:19

    Replace the IConnectionIdFactory with your own https://github.com/SignalR/SignalR/wiki/Extensibility.

    Sample usage: http://www.kevgriffin.com/maintaining-signalr-connectionids-across-page-instances/

    EDIT: This is no longer supported in the latest versions of SignalR. But you can define a user id for a specific connection using the new IUserIdProvider

提交回复
热议问题