Git Product home page Git Product logo

signalr.proxygenerator's Introduction

Build status

SignalR.ProxyGenerator

Small wrapper over the SignalR Proxy Generator to allow you to create the proxies at build time. This will generate the normal proxy for any assmblies loaded into the app domain. All the comments are stripped out from the top. You an then prepend any text lines into the top of the proxy using the metadata array, this allows you to specify your own dependency path comments for things like jQuery.

https://www.nuget.org/packages/SignalR.ProxyGenerator

Usage

SignalR.ProxyGenerator

The utility library is simple to use, load any assemblies required and then create a SignalRProxyGenerator and call Generate. It returns the JavaScript as a string. We can't pick a specific assembly to scan because we are using the SignalR DefaultHubManager which looks in all loaded assemblies.

/// <summary>
/// Returns the JavaScript proxy for any hubs found in any assemblies loaded into the AppDomain
/// </summary>
/// <param name="signalRUrlPath">The service URL used by the connection. Defaults to "/signalr". When created dynamically this would generate at the running address, for example if you had an IIS app called "MyApp" it would generate "http://localhost:port/MyApp/signalr".</param>
/// <param name="metaData">An array of lines to prepend into the file. This can be useful if you want to specify a path in your build system to a dependency such as jQuery</param>
/// <returns>JavaScript proxy code</returns>
string Generate(string signalRUrlPath = "/signalr", params string[] metaData);

SignalR.ProxyGenerator.Console

This will output the JavaScript to the specified file path

.\SignalR.ProxyGenerator.Console.exe -a "c:\etc\path-to-myassembly.dll" -o "C:\temp\hubs.js" -m "// Some metadata I want,// Other metadata"

# ONLY COMBATIBLE WITH SIGNALR VERSIONS AT 2.2.1.0 OR EARLIER #

We have compiled this at verison 2.2.1.0 so in order for the HubManager to recognise your hubs we are using an assembly redirect. If Microsoft release a new version we will need to update this.

<dependentAssembly>
    <assemblyIdentity name="Microsoft.AspNet.SignalR.Core" publicKeyToken="31bf3856ad364e35" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-2.2.1.0" newVersion="2.2.1.0" />
  </dependentAssembly>

If the output file is not specified the result is written to standard out.

signalr.proxygenerator's People

Watchers

James Cloos avatar Fernando Nogueira avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.