/// <summary> /// Extension method to use the JsonRpc router in the Asp.Net pipeline /// </summary> /// <param name="app"><see cref="IApplicationBuilder"/> that is supplied by Asp.Net</param> /// <param name="configureOptions">Action to configure routing</param> /// <returns><see cref="IApplicationBuilder"/> that includes the Basic auth middleware</returns> public static IApplicationBuilder UseJsonRpcWithWebSockets(this IApplicationBuilder app, Action <SingleRouteOptions> configureOptions) { if (app == null) { throw new ArgumentNullException(nameof(app)); } if (configureOptions == null) { throw new ArgumentNullException(nameof(configureOptions)); } var options = new SingleRouteOptions(); configureOptions(options); return(app.UseJsonRpcWithWebSockets(options)); }
/// <summary> /// Extension method to use the JsonRpc router in the Asp.Net pipeline /// </summary> /// <param name="app"><see cref="IApplicationBuilder"/> that is supplied by Asp.Net</param> /// <param name="configureOptions">Action to configure routing</param> /// <returns><see cref="IApplicationBuilder"/> that includes the Basic auth middleware</returns> public static IApplicationBuilder UseJsonRpcWithWebSockets(this IApplicationBuilder app, SingleRouteOptions options) { if (app == null) { throw new ArgumentNullException(nameof(app)); } if (options == null) { throw new ArgumentNullException(nameof(options)); } IRpcRouteProvider routeProvider = new RpcSingleRouteProvider(Options.Create(options)); return(app .UseWebSockets() .UseJsonRpcWithWebSockets(routeProvider)); }