Exemple #1
0
        /// <summary>
        /// Stops and Disposes of the Web and Web Socket Servers
        /// </summary>
        public static void Stop()
        {
            if (server == null)
            {
                return;
            }

            wss.Dispose();
            server.Dispose();
            server = null;
            wss    = null;
        }
Exemple #2
0
        /// <summary>
        /// Starts the primary Web server and Web Socket Server
        /// </summary>
        public static void Start()
        {
            if (server != null)
            {
                return;
            }
            server = new WebServer(String.Format("http://localhost:{0}/", port));

            // FIXME: EmbedIO 3.0 is moving to a more general FileModule in-place of this one
            server.RegisterModule(new StaticFilesModule(webPath));

            wss = new SMMWebSocketServer();
            server.RegisterModule(new WebSocketsModule());
            server.Module <WebSocketsModule>().RegisterWebSocketsServer <SMMWebSocketServer>("/wss", wss);

            server.RunAsync();
        }