HelloWeb

Example 10-1, our first web server program using a relay. Note that the relay domain and secret key used below are just examples that won’t work for you, so you need to provide your own values. Alternatively, if you only want to try out the server within your home network, you can just omit the RelayDomain and RelaySecretKey lines completely (or comment out by prefixing them with //), thereby switching off the relay mechanism.

Example 10-1. HelloWeb

using Gsiot.Server;

public class HelloWeb
{
    public static void Main()
    {
        var webServer = new HttpServer
        {
            RelayDomain = "gsiot-FFMQ-TTD5",
            RelaySecretKey =
                "o5fIIZS5tpD2A4Zp87CoKNUsSpIEJZrV5rNjpg89", RequestRouting = { { "GET /hello", context => { context.SetResponse("Hello Web", "text/plain"); ...

Get Getting Started with the Internet of Things now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.