[[tutorials:legacy:html5|{{ :html5-badge-h-connectivity-graphics.png }}]]

This binding has been deprecated - please see the most recent [[:release_notes| release notes]] for more information.

====== Webserver Socket Setup ====== ===== Introduction ===== In this tutorial, you will be creating a boilerplate HTML canvas application, using the Javascript bindings to connect to a GestureWorks websocket server instance. You will learn how to load and initialize GestureWorks. For this tutorial you will need the GestureWorks Core websocket server. ---- ===== Requirements ===== * A Windows 7 or 8 computer * Compiled GestureWorks Websocket Server: [[http://files.gestureworks.com/downloads/gw_websocket_server.zip|Gestureworks_Websocket.zip]] * Or GestureWorks Websocket Server source code: [[http://files.gestureworks.com/downloads/gw_websocket_source.zip|Gestureworks_Websocket_Source.zip]] ---- ===== Process Overview ===== - [[tutorials:legacy:html5:websocket_server_setup#server_operation|Server Operation]] - [[tutorials:legacy:html5:websocket_server_setup#source_code_overview|Source Code Overview]] ---- ===== Process Detail ===== ==== 1. Server Operation ==== The GestureWorks websocket server is distributed as a zip file containing several .dlls, an executable (GestureWorks.Websocket.exe), and a GML file called 'basic_manipulation.gml'. The zip includes a trial version of GestureWorks Core. This trial is available [[http://www.gestureworks.com/collections/all|here]]. The server is a .NET console application with one optional argument to define which port number the server should run on. By default, the server uses port 4000. The executable 'GestureWorks.Websocket.exe' can be ran from command prompt or opened from a file explorer instance. The server will run until the window is closed or the user enters the 'exit' command. The basic_manipulation.gml file is used to define gestures. More information on this can be found [[http://www.gestureml.org/|here]]. Note: The intention of the server is to provide a basic binding to the GestureWorks core functionality. Each server instance will only manage one instance of the GestureWorks Core library with the intention of supporting one client. It is recommended to restart the server any time the client is restarted, crashes and undesirable behavior should be expected otherwise. ==== 2. Source Code Overview ==== The source code for the server can be found [[http://files.gestureworks.com/downloads/Gestureworks_Websocket_Source.zip|here]]. The GestureWorks Websocket Server is composed of three Visual Studio projects and two nuget packages: * Fleck * gwc_net * Newtonsoft.json (nuget package) * CommandLineParser (nuget package) * GestureWorks.Websocket Fleck is a websocket server library for .NET applications. Fleck was chosen over other alternatives due to its simplicity and robustness. The Fleck project can be found [[http://github.com/statianzo/Fleck|here]]. gwc_net is the .NET binding for GestureWorks Core. This binding is bundled with GestureWorks Core. [[http://www.newtonsoft.com/json|Newtonsoft.Json]] and is included in the GestureWorks.Websocket project as a [[http://www.nuget.org/packages/Newtonsoft.Json/|nuget package]] to provide JSON encoding and decoding. The primary use of this library is to create GwCommand instances based on incoming data from a client and to parse server created GwCommand instances that are outgoing to the client. [[http://www.nuget.org/packages/CommandLineParser/|CommandLineParser]] is a nuget package included in the GestureWorks.Websocket project which provides command line argument parsing and mapping. This library is used to provide the optional '-p' argument standing for 'port' when the application is ran from command prompt. GestureWorks.Websocket is the primary project that brings the other libraries together in the form of a console application. The majority of the logic of the application can be found in Program.cs. Communication between a client and this server is made up of serialized JSON objects representing GwCommand instances. Refer to the Program.cs file in the GestureWorks.Websocket project for more information. ---- ===== Review ===== After this tutorial, you should have a working Gestureworks Websocket server running on your local machine. ---- Next up: [[tutorials:legacy:html5:getting_started|HTML5: Getting Started]]