Beispiel #1
0
        /// <summary>
        /// Add WebSocketsModule to WebServer.
        /// </summary>
        /// <param name="webserver">The webserver instance.</param>
        /// <param name="assembly">The assembly to load Web Sockets from. Leave null to avoid autoloading.</param>
        /// <returns>An instance of webserver.</returns>
        /// <exception cref="System.ArgumentNullException">webserver.</exception>
        public static IWebServer WithWebSocket(this IWebServer webserver, Assembly assembly = null)
        {
            if (webserver == null)
            {
                throw new ArgumentNullException(nameof(webserver));
            }

            webserver.RegisterModule(new WebSocketsModule());
            return(assembly != null?webserver.LoadWebSockets(assembly) : webserver);
        }