Skip to content

How to send message to specific User by id? #1

@bakamaru

Description

@bakamaru

I'm trying to send messages to connected users across multiple browser by using this following code as mentioned on docs

  await busControl.Publish<User<ChatHub>>(new
                {
                    UserId = 1,
                    Messages = protocols.ToProtocolDictionary("broadcastMessage", new object[] { "backend-process", "user id 1" })
                });

though sending to all or specific connection ids are working

 await busControl.Publish<All<ChatHub>>(new
                {
                    Messages = protocols.ToProtocolDictionary("broadcastMessage", new object[] { "backend-process", value })
                });              
              
               
                string cid = "A7axrqsCxdWXp6HydpNM-g";
                await busControl.Publish<Connection<ChatHub>>(new
                {
                    ConnectionId = cid,
                    Messages = protocols.ToProtocolDictionary("broadcastMessage", new object[] { "backend-process", value })
                });

All i want to send msg to specific user who having multiple connection ids. I didn't find any related docs for custom mapping while connecting to signalr hub.
How to map loggedin userid to signalr hub with masstransit so that i can use Publish<User> as working.
Any help regarding this.Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions