Skip to content
Branch: master
Find file History
Latest commit 64df00a Oct 19, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
www Changes Oct 18, 2019
Butterfly.Example.Echo.csproj Changes Oct 18, 2019
NLog.config Changes Oct 18, 2019
Program.cs Changes Oct 18, 2019 Changes Oct 18, 2019

Echo Example

A simple echo web client and server using Butterfly.Clients, Butterfly.Web, and Butterfly.Db

This example shows...

  • A plain HTML/JS client subscribing to the Subscription API via the Butterfly.Clients web client to receive updates on the "messages" channel and echoing any updates in an alert() box
  • A plain HTML/JS web client invoking a Web API method to insert a "Hello World" message
  • Implementing the Web API from Butterfly.Web on the server
  • Implementing the Subscription API from Butterfly.Web on the server
  • Using Butterfly.Db on the server to perform database operations and publish the data change events to subscribers

This example uses a plain HTML/JS client but the Butterfly.Clients web client is vanilla javascript and can be used with any framework.

This example uses the EmbedIO web server but Butterfly.Web supports multiple web servers.

This example uses a memory database but Butterfly.Db supports multiple database engines.

Get the Code

git clone


Open a terminal or command prompt and run...

cd butterfly-server\Butterfly.Example.Echo\www
npm install
cd ..
dotnet run www

Open a browser to http://localhost:8000/ and you should see "Hello World" shown in an alert box.

You can’t perform that action at this time.