public HostedAppServiceImpl(DeviceHiveConfiguration configuration, Router router) { var hosting = configuration.WebSocketEndpointHosting; if (string.IsNullOrEmpty(hosting.HostPipeName) || string.IsNullOrEmpty(hosting.AppPipeName)) throw new ConfigurationErrorsException("Please specify hostPipeName and appPipeName in the webSocketEndpointHosting configuration element!"); _service = new ApplicationService(hosting.HostPipeName, hosting.AppPipeName); _service.ConnectionOpened += (s, e) => router.HandleNewConnection(e.Connection); _service.MessageReceived += (s, e) => router.RouteRequest(e.Connection, e.Message); _service.ConnectionClosed += (s, e) => router.CleanupConnection(e.Connection); }
public SelfHostServiceImpl(DeviceHiveConfiguration configuration, WebSocketServerBase server, Router router) { if (configuration == null) throw new ArgumentNullException("configuration"); if (server == null) throw new ArgumentNullException("server"); if (router == null) throw new ArgumentNullException("router"); _configuration = configuration; _server = server; _server.ConnectionOpened += (s, e) => router.HandleNewConnection(e.Connection); _server.MessageReceived += (s, e) => router.RouteRequest(e.Connection, e.Message); _server.ConnectionClosed += (s, e) => router.CleanupConnection(e.Connection); }
public static void ConfigureRoutes(Router router) { router.RegisterController("/client", typeof(ClientController)); router.RegisterController("/device", typeof(DeviceController)); }