Closed larsbuch closed 5 years ago
Take a look at the MulticastVM API doc and the Chat Room example.
On Mon, Oct 15, 2018 at 7:39 PM Lars Shakya Buch-Jepsen < notifications@github.com> wrote:
It would be nice to have an example of how to access SignalR Clients and Groups either from Middleware or from VM
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dsuryd/dotNetify/issues/128, or mute the thread https://github.com/notifications/unsubscribe-auth/AOS8khp9W01R5HtMBEOAHAioisyCtTw1ks5ulUbFgaJpZM4XdeBT .
@larsbuch here are links for MulticastVM API and the Chat Room example
I have been looking at the MulticastVM/BaseVM and Chat Room examples. I have not found it in either.
@bugged84 : It is not nice to make issue hijacking for irrelevant information. Normally you should open a new issue for the discussion.
@larsbuch: I may not be understanding you; what kind of example you're looking for? MulticastVM provides a Send
method to send message to any SignalR clients and groups. For direct access to SignalR APIs, inject their IHubContext
as documented in SignalR website.
@bugged84: Please create a new issue for us to discuss on how to implement group chat rooms.
I can see that the used signalr hub is DotNetifyHub
The way to access Groups and Users is through
IHubContext context = GlobalHost.ConnectionManager.GetHubContext<DotNetifyHub>();
@dsuryd do you have an example of the MulticastVM
Send
method that you referred to above? Does the second argument propertyName
refer to the name of a property on the React component's state object?
I set propertyName
to "hello" and propertyValue
to "world" and the following was logged in the browser console.
[ChatRoomLobby] received>
{hello: "world"}
What can be done with this? For example, what if I want the React component to display the value of the hello
property? How can this be done?
The chat room example uses the Send
method to send private message to chat users.
It would be nice to have an example of how to access SignalR Clients and Groups either from Middleware or from VM