Skip to content
.NET bindings for Hydna
Find file
New pull request


# .NET bindings for Hydna

Full bindings for Hydna's bi-directional and push protocols.

More info:

## Installation

Install the package NuGet via terminal:

    mono nuget.exe install

Or via Package Manager Console:

    PM> Install-Package Hydna.Net 

## Compatibility

- Full support for .NET 2.0 - 4.5
- Full support in Unity (both Free and Pro)

Please not that support for Silverlight, Windows Phone and Windows 8 is planed
and will be released shortly.

## Bindings for Unity

Please see for more information.

## Usage

Example using a full bi-directional channel:

        static Channel channel;

        public static void Main(string[] args) 
            channel = new Channel();

            channel.Connect("", ChannelMode.ReadWrite);

            channel.Open += c_Open;
            channel.Data += c_Data;
            channel.Closed += c_Closed;

            while (channel != null)

        static void c_Open(object sender, ChannelEventArgs e)
            Console.WriteLine("Channel is now open: " + e.Text);
            channel.Send("Hello world");

        static void c_Data(object sender, ChannelEventArgs e)
            Console.WriteLine("Received data: " + e.Text);

        static void c_Closed(object sender, ChannelCloseEventArgs e)
            Console.WriteLine("Channel is now closed, bye..");
            channel = null;

Example how to send data (via Push) to a specific channel using C#:

      using Hydna.Net;

      // Create a new HttpApiClient
      HttpApiClient client = HttpApiClient.create("");

      // Send a "Hello world" message to the channel.
      client.Send("Hello world from C#");

Example how to send data (via Push) a specific channel Async using C#:

      using Hydna.Net;

      // Create a new HttpApiClient
      HttpApiClient client = HttpApiClient.create("");

      // Begin the send async operation channel.
      IAsyncResult result = client.BeginSend("Hello world from C#", null, null);

      // Wait for the response

      // End the async operation.

## Testing

All tests are predefined to run against ``.

### Test using mono

A simple Makefile is included which can be used to invoke the embedded test

To run the test suite for .Net 2.0, call:

    $ make test20

To run all test, for all version, call:

    $ make test

### Test SSL in mono

You need to add the certificate for the domain to test against. In order to
test against ****, run the following commands from the
commmand line:

        $ mozroots --import --ask-remove --machine
        $ certmgr -ssl
Something went wrong with that request. Please try again.