Real-time chat application with stock quote integration. Built with .NET 8, SignalR, and RabbitMQ.
- User authentication (register/login)
- Real-time chat using SignalR
- Stock quotes via
/stock=CODEcommand (e.g.,/stock=AAPL.US) - Message persistence (last 50 messages)
- Decoupled bot architecture using RabbitMQ
┌─────────────────────────────────────────────────────────────────┐
│ LiveStock.Web LiveStock.Bot │
│ │
│ Browser ─► SignalR Hub │
│ │ │
│ ├── /stock=XXX ──► [stock-commands] ──► Worker │
│ │ │ │
│ │ stooq.com │
│ │ │ │
│ StockResponseConsumer ◄────── [stock-responses] ◄──────┘ │
│ │ │
│ └──► SignalR ──► All Browsers │
└─────────────────────────────────────────────────────────────────┘
- .NET 8 SDK
- Docker Desktop (for RabbitMQ)
docker run -d --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:managementManagement UI: http://localhost:15672 (guest/guest)
cd src/LiveStock.Web
dotnet ef database updateTerminal 1 - Web Application:
dotnet run --project src/LiveStock.WebTerminal 2 - Stock Bot:
dotnet run --project src/LiveStock.BotOpen https://localhost:5001 (or the URL shown in terminal)
- Register a new account
- Navigate to Chat
- Send messages or use
/stock=AAPL.USto get stock quotes
| Password | |
|---|---|
| alice@livestock.app | LiveStock2025! |
| bob@livestock.app | LiveStock2025! |
Open two browser windows, login with different users, and start chatting.
dotnet testLiveStock/
├── src/
│ ├── LiveStock.Web/ # ASP.NET Core web app
│ │ ├── Data/ # EF Core DbContext
│ │ ├── Hubs/ # SignalR ChatHub
│ │ ├── Models/ # Domain models
│ │ ├── Pages/ # Razor Pages
│ │ └── Services/ # RabbitMQ services
│ └── LiveStock.Bot/ # Worker service (stock bot)
└── tests/
└── LiveStock.Tests/ # Unit tests
- ASP.NET Core 8 + Razor Pages
- ASP.NET Core Identity (authentication)
- SignalR (real-time communication)
- Entity Framework Core + SQLite
- RabbitMQ (message broker)
- xUnit + Moq (testing)
| Method | Description |
|---|---|
SendMessage(message) |
Send a chat message or stock command |
GetRecentMessages() |
Get last 50 messages |
| Event | Parameters | Description |
|---|---|---|
ReceiveMessage |
user, message, timestamp | New message received |
/stock=CODE
Examples: /stock=AAPL.US, /stock=MSFT.US, /stock=GOOGL.US
The bot fetches data from stooq.com and returns the closing price.