examples/razorwire-mvc/Controllers/ReactivityController.cs
ReactivityController
Type
ReactivityController
A controller that facilitates real-time reactivity, including user registration, chat messaging, and counter synchronization.
Method
Index()
Renders the controller's default view for the reactivity UI.
Method
Sidebar()
Renders the sidebar inside a RazorWire frame with the ID "permanent-island".
Method
UserList()
Renders the UserList view component inside a Turbo/RazorWire frame with the ID "user-list".
Method
RegisterUser(string)
Registers the provided username, persists it in an HttpOnly cookie, and broadcasts the user's presence to other clients.
Method
PublishMessage(string)
Publishes a chat message to connected clients and returns a Turbo/RazorWire stream or a redirect.
Method
IncrementCounter(int)
Increments the server and session counters and returns a Turbo/RazorWire stream to update the UI or a safe redirect.
Method
BroadcastUserPresenceAsync(string)
Broadcasts a user's presence to connected clients and updates the rendered user list and count.