JDI PusherClient

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

The design is based on the Pusher Protocol, and on the IETF RFC-6455 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
- GHI Software Package v4.2 Feb. 18, 2013 (needed to run the MFConsoleApp on a GHI Cobra I board)

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 (to load the AppKey).
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 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.PusherClient.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).

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.

Create a Pusher account:
- Go to http://pusher.com/ and create a new account.
- Remember your AppID and AppKey.
- Open the Pusher Debug Console at https://app.pusherapp.com/apps/yourAppID/debug.

Running the MFConsole application:
- Format an SD card as FAT32, and create a jdiPusher directory at the root.
- Create a new text file named MFConsoleApp.ini in the new directory.
- Add the following as the first line in this file:
appKey=yourappkey
- Replacing "yourappkey" by your actual AppKey from Pusher.
- Place the SD card in your .NETMF controller board.
- Connect your 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.
- On the Pusher Debug Console you should see your device open a connection to Pusher.
- Using the Pusher Event Creator, send a "testEvent" on the "testChannel".
- Next send a "closeEvent" on the "testChannel".
- On the Debug output in Visual Studio, you should see output similar to that shown below.

MFConsoleOutput.jpg

Running the WinForm application:
- Create a jdiPusher directory at the root of your C: drive.
- Create a new text file named WinFormApp.ini in the new directory.
- Add the following as the first line in this file:
appKey=yourappkey
- Replacing "yourappkey" by your actual AppKey from Pusher.
- Build and run the application.
- The output screen shown below should appear.
- Click Connect to connect to your application on Pusher.
- On the Pusher Debug Console you should see your device open a connection to Pusher.
- Click Subscribe to subscribe to the "testChannel".
- Using the Pusher Event Creator, send a "testEvent" on the "testChannel".
- You should see the response in the WinFormApp window.
- When done, click Unsubscribe, and then click Disconnect.
- Using the Form logger, you should see output similar to that shown below.

WinFormOutput.jpg


Last edited Apr 10, 2013 at 6:33 AM by jasdev55, version 14

Comments

No comments yet.