User Tools

Site Tools


tutorials:legacy:html5:websocket_server_setup

This binding has been deprecated - please see the most recent 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


Process 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 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 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 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 here.

gwc_net is the .NET binding for GestureWorks Core. This binding is bundled with GestureWorks Core.

Newtonsoft.Json and is included in the GestureWorks.Websocket project as a 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.

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: HTML5: Getting Started

tutorials/legacy/html5/websocket_server_setup.txt · Last modified: 2019/01/21 19:24 (external edit)