asp.net mvc - SignalR - Calling Hub class method (present in a separate MVC project) from Server side code -


i have read signalr tutorials. in order implement signalr in existing asp.net solution application did following:

i have created separate mvc 4 project , created hub class along methods, can called other mvc project/client present in existing solution, means use service.

but have 2 questions:

  1. how can call other mvc project. same way mentioned in tutorials, example adding necessary script files in head of .cshtml page , using js script following:

    var hub = $.connection.; //and

    hub.server.send("some args");

  2. i want call hub code directly server side code. did before when using supersocket. same approach using signalr. how can ?

if answer, kindly please give code sample(s). many thanks.

there sample code calling client methods outside hub class (but within application) here. basically, use connectionmanager call hub's clients.

var context = globalhost.connectionmanager.gethubcontext<myhub>(); context.clients.all.myclientmethod(myvalue); 

to call outside application, i'd use sort of exposed method or service , wrap above code.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -