RazorDocs Search

Controllers

Type

ReactivityController

A controller that facilitates real-time reactivity, including user registration, chat messaging, and counter synchronization.

Method

Index

IActionResult Index()

Renders the controller's default view for the reactivity UI.

Returns

An IActionResult that renders the default view.

Method

Sidebar

IActionResult Sidebar()

Renders the sidebar inside a RazorWire frame with the ID "permanent-island".

Returns

An IActionResult that produces the RazorWire frame containing the sidebar content.

Method

UserList

IActionResult UserList()

Renders the UserList view component inside a Turbo/RazorWire frame with the ID "user-list".

Returns

An IActionResult that renders the UserList view component wrapped in a Turbo/RazorWire frame with id "user-list".

Method

RegisterUser

Task<IActionResult> RegisterUser(string username)

Registers the provided username, persists it in an HttpOnly cookie, and broadcasts the user's presence to other clients.

Parameters

  • usernameThe username submitted from the registration form. If empty or whitespace, no username is persisted or broadcast.

Returns

A Turbo Stream that replaces the message form and updates the register form when the request is a Turbo request; otherwise a redirect to the Index action.

Method

PublishMessage

Task<IActionResult> PublishMessage(string message)

Publishes a chat message to connected clients and returns a Turbo/RazorWire stream or a redirect.

Parameters

  • messageThe message text submitted from the form.

Returns

`A Turbo/RazorWire` stream that replaces the message form when the request is a Turbo request; otherwise a redirect to the Index action.

Method

IncrementCounter

IActionResult IncrementCounter(int clientCount)

Increments the server and session counters and returns a Turbo/RazorWire stream to update the UI or a safe redirect.

Parameters

  • clientCountThe current session client count (will be incremented).

Returns

`IActionResult` that is a Turbo stream updating counters for Turbo requests; otherwise a redirect to the referring local URL or the Index action.

Method

BroadcastUserPresenceAsync

Task BroadcastUserPresenceAsync(string username)

Broadcasts a user's presence to connected clients and updates the rendered user list and count.

Parameters

  • usernameThe display name to mark as active and include in the rendered user list.
Type

NavigationController

A controller that demonstrates stateful navigation and island persistence in RazorWire.

Method

Index

IActionResult Index()

Renders the default view for the navigation index action.

Returns

A ViewResult that renders the default view for this action.

Type

HomeController

The default controller for the application, providing the entry point view.

Method

Index

IActionResult Index()

Renders the default view for the Home controller's Index action.

Returns

The view result for the Index action.