This demo shows how a .NET server (or any other TCP server) can provide realtime messaging to a HTML client. To do so, the .NET server starts a small node.js server which proxies messages to and from the web browser using socket.io.
In Visual Studio 2010, open messaging-demo.sln and build the solution (Build -> Build solution).
From the command line, run MSBuild:
> msbuild messaging-demo.sln /p:Configuration=Release
In Visual Studio 2010, there is some initial setup, as these type of settings are stored in the project's .suo file.
-
Set both the
Server
project and theWeb
website as startup projects:- right-click
messaging-demo.sln
in Project Explorer - select "Set StartUp Projects..."
- select "Multiple startup projects"
- set both project's Action to be "Start"
- right-click
-
Start the browser when
Web
starts instead of running the ASP.NET server:- right-click on the
Web
project - select "Property Pages"
- select "Start Options"
- set the "Start URL" to http://localhost:9876
- right-click on the
Then starting the solution will launch the application.
From the command line, run Server.exe:
> Server\bin\Release\Server.exe
And either in a new command prompt:
> start http://localhost:9876
Or just navigate there in an open browser of choice. This will launch the demo.
A majority of the server is .NET-based, so use your usual .NET development tools (aka. Visual Studio 2010 or VIM+command-line for the brave).
The client and web-server Web
can either be developed using
a text-editor and a command-line, as the server is node.js
based, and the client is only HTML, or Visual Studio.
The client uses CoffeeScript, which most editors don't support out of the box, though you can download plugins to provide support. Here are a few: