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:
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");
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
Post a Comment