c# - mvc controller read signalr value -


we using asp.net mvc signalr communicate browser's client side code.

currently our hub built as:

public class sectionhub : hub { } 

mvc controller gets reference it. , within loop uses hub notify client when steps done:

var progresshub = globalhost.connectionmanager.gethubcontext<sectionhub>(); progresshub.clients.all.updatecurrentprogress(....) 

all works fine. adding stop button on client , want notify mvc controller stop process when it's clicked. updated sectionhub include property client able update. however, since progresshub object ihubcontext not have access property. there anyway new property hub , have accessible in mvc controller, or create hub sectionhub rather ihubcontext?

you should not have kind of logic in hub, hub should used push state. move code background worker, let mvc controller action queue work , return directly (long running controller action anti pattern). let stop mvc controller action call worker queue , tell stop work.

thats more solid solution if ask me.

edit: btw, think library you, use seamless push progress state worker clients https://github.com/andersmalmgren/signalr.eventaggregatorproxy/wiki


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -