Stop using magic strings like "ReceiveMessage". In enterprise .NET, we use **Strongly Typed Hubs** to prevent bugs and enable IntelliSense.
Define an interface (e.g., IChatClient) with all the methods the client can handle. Then, derive your Hub from Hub<IChatClient>. Now, Clients.All.ReceiveMessage(msg) is compile-time checked. If you rename the method in the interface, the compiler will force you to update it everywhere.
Place this interface in a **Shared Class Library**. Your C# Client (like a Blazor WASM or a worker service) can also use this interface to register its handlers. This ensures that the server and client are always speaking the same 'Language'.
Q: "Should I use strongly typed hubs for JS clients?"
Architect Answer: "YES. Even though Javascript isn't compiled, using the interface on the server ensures consistency. For TypeScript clients, you can even use tools to generate the TS interfaces from your C# DLL, giving you full end-to-end type safety for your real-time messages."