Wednesday, January 23, 2013

WebSocket: Alchemy - C# <-> javascript

Reference: http://divyen.wordpress.com/2012/06/13/html5-developing-websocket-server-using-c-sharp-dot-net/ 

Downloaded src code. http://alchemywebsockets.net/
Open it in Visual C# 2010 express
Managed to compile and get the Alchemy.dll

Created a new Console app project. added DLL
added the codes. https://gist.github.com/2976928
Build and then error....

Warning 8 - The referenced assembly "Alchemy" could not be resolved because it has a dependency on "System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove references to assemblies not in the targeted framework or consider retargeting your project.

Go to Project Properties > application > Target Framework > .NET Framework 4
Click Yes for message box.

Build and Run. no more error.

added HTML codes. https://gist.github.com/a9409a82d2379d52e9af
run in chrome. HTML connected with websocket. clock ticking. cool.