javascript - SignalR sharing connection between 2 apps -


i have 2 projects in solution, 1 mvc app , second 1 simple windows forms app. i'm trying do, testing purposes, control content on mvc app through windows forms app. simplify further, have button on app, should, when clicked, update html on connected clients. mvc should manage client connections, , forms app should dedicated content administration.

what did - mvc hub setup

public class connectionhub : hub {     public void update()     {         clients.all.updatesequence(" ");     } } 

mvc startup setup:

[assembly: owinstartup(typeof(web.startup))]  namespace web {     public class startup     {         public void configuration(iappbuilder app)         {                   globalhost.dependencyresolver.usesqlserver(         configurationmanager.connectionstrings["signalr"].connectionstring);             app.mapsignalr();         }     } } 

forms app - on button clicked event:

 private void button1_click(object sender, eventargs e)  {         var context = globalhost.connectionmanager.gethubcontext<connectionhub>();         context.clients.all.updatesequence(" ");  } 

javascript client function "updatesequence()" should ok because tested in different setups , worked. database connection works.

edit: question - how make work? doesn't work in current setup. context in forms loaded , "updatesequence" method called, nothing happens.

you calling server-side code in winforms app, not right. in winforms app should reference signalr .net client library, , 1 connect server , call methods hub (or maybe 1 might want introduce admin purposes).

have @ this: http://www.asp.net/signalr/overview/guide-to-the-api/hubs-api-guide-net-client

also, unless planning have multiple server , need horizontal scalability, @ stage not main concern, not need sql server backplane @ (call usesqlserver in startup class).


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

datatable - Matlab struct computations -