Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

2 watching

Forks

Latest commit

 

History

20 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

WebSocketChart

A full-stack WebSharper application that streams data from the server to the browser over a WebSocket and plots it as a live line chart with Chart.js.

screenshot

How it works

  • Server — WebSocketChart/WebSocketServer.fs defines a typed StatefulAgent that pushes a new random number to the client every second on the /ws endpoint.
  • Client — WebSocketChart/WebSocketClient.fs connects to /ws with a plain WebSharper.JavaScript.WebSocket, decodes the JSON messages, and feeds each value into an Event<string * float> that drives the chart. It also logs every message next to the chart.
  • Page — WebSocketChart/Website.fs is a server-rendered sitelet that hosts the client entry point; WebSocketChart/Main.html is its template.

Running locally

dotnet run --project WebSocketChart

Then open http://localhost:5350.

The app runs on port 5350, not the ASP.NET Core default 5000: on macOS, AirPlay Receiver listens on 5000 and answers browser requests with 403 Forbidden. The port comes from WebSocketChart/Properties/launchSettings.json; override it with ASPNETCORE_URLS if you prefer.

Building

dotnet build WebSocketChart/WebSocketChart.fsproj -c Release

Notes

  • Main.html contains an import map for chart.js/auto — the one bare module specifier that WebSharper.Charting emits. The client is served as native ES modules, so no bundler is needed.
  • The project targets .NET 10 and WebSharper 10 and no longer uses Paket.

CI

Every push to master and every pull request builds the app in Release via .github/workflows/build.yml. Being a server + WebSocket app, it is not deployed to gh-pages.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages