This project is read-only.

JDI WebSocketClient

This project implements a full featured WebSocket client for .NET and .NETMF, and includes a .NET Win Forms application and a .NETMF console application to demonstrate how to use the WebSocketClient class.

The design is based on IETF RFC-6455 The WebSocket Protocol

Project Requirements:
Download and install these files in the order listed below.
- Visual Studio 2010
- Microsoft .NET Micro Framework 4.2 QFE2 SDK
- NETMF and Gadgeteer Package 2013 R3

Hardware Requirements:
This project may be tested using the included WinForm application on your PC, or using the MFConsole application on a suitable .NETMF controller board. The controller board must meet these minimum requirements:
- Able to run .NETMF 4.2
- Has an built-in or external IP network interface.
- Includes an SD card (if the FileLogger is used).
The MFConsole application was tested on a GHI Electronics Cobra 1 board. This board is no longer available, and has been replaced by the Cobra II board, which should work fine with little or no changes to the code.

Project Installation and Setup:
  1. Download the project zip file
  2. Extract the zip file into a folder on your hard disk
  3. Open the solution file (JDI.WebSocket.sln) using Visual C#
  4. If you want to run the MF Console application:
    1. Right-click on the MFConsoleApp project, and choose Set as StartUp Project from the context menu.
    2. Right-click on the solution name, and choose Configuration Manager... from the context menu.
    3. In the Configuration Manager dialog-box, check the Deploy checkbox next to the project name, then click Close (see below).
  5. If you want to run the Win Form application:
    1. Right-click on the WinFormApp project, and choose Set as StartUp Project from the context menu.
    2. Right-click on the solution name, and choose Configuration Manager... from the context menu.
    3. In the Configuration Manager dialog-box, uncheck all Deploy checkboxes, then click Close.
Configuration for MF Console application:
ConfigMFConsole.jpg

Configuration for Win Form application:
ConfigWinForm.jpg

Select a logging device:
- DebugLogger - outputs to the debug console.
- FileLogger - outputs to a file on disk or on SD card.
- FormLogger - outputs to a ListView control on the main form (WinForm application only).
	// init logger
	//	fileLogger.Open(logFilePath, logFileName);
	//	Logger.Initialize(fileLogger, LogLevel.Debug);
	Logger.Initialize(new DebugLogger(), LogLevel.Info);

Set the logging level:
- Error - only error messages will be logged.
- Info - both Error and Info messages will be logged.
- Debug - all message types will be logged.

Running the MFConsole application:
- Connect your .NETMF controller board to the USB port of your computer.
- Right-click on the MFConsoleApp project, and select Properties.
- Select the .NET Micro Framework tab in the Properties window.
- Set the Transport to "USB".
- Select your Device ("EMX_EMX" for my Cobra 1 board).
- Save your changes.
- Build and run the application.
- Using the Debug logger, you should see output similar to that shown below.

MFConsoleOutput.jpg

Running the WinForm application:
- Build and run the application.
- The output screen shown below should appear.
- Click Connect to connect to the websocket "echo" server.
- Enter a message into the textbox, and click Send Message.
- When done, click Disconnect.
- Using the Form logger, you should see output similar to that shown below.

WinFormOutput.jpg


Last edited Jan 1, 2014 at 4:15 AM by jasdev55, version 20

Comments

No comments yet.