stevenlovegrove / MqttDotNet

.net Implementation of the client half of the MQTT messaging protocol. MQTT is a lightweight, open specification publish and subscribe protocol cheifly developed by IBM. Details of MQTT can be found at http://mqtt.org.
MIT License
153 stars 91 forks source link

help : a problem on PublishArrivedDelegate #13

Closed muscle090620118 closed 9 years ago

muscle090620118 commented 9 years ago

I'm making a client with aspx Page, and I want to change a asp:Label‘s Text when PublishArrived.
Code : bool client_PublishArrived(object sender, PublishArrivedArgs e) { msgLabel.Text=e.Payload; return true; } code runs Smoothly ,But nothing happend after the Code executed. why? Can it interact with an asp control ?

stevenlovegrove commented 9 years ago

I know nothing about asp.net, sorry. You should try logging to the console instead to try to isolate where the problem lies. GUI's sometimes dislike being changed from a different thread - that may be your problem here.

iplusplus commented 9 years ago

Have you set up your page properly to respond to the server side changes? You can't push a change to a web page directly unless you're using websockets. You'd need some kind of call back from the web page. I know asp.net webforms does some of this sort of stuff for you, but not sure how much.

If I were doing this, I'd have a client side timer triggering an ajax call back to the server to check the state of a model. You would, of course need to be handling your session state to enable this to work properly.

On 1 April 2015 at 08:10, muscle090620118 notifications@github.com wrote:

I'm making a client with aspx Page, and I want to change a asp:Label‘s Text when PublishArrived.

Code : bool client_PublishArrived(object sender, PublishArrivedArgs e) { msgLabel.Text=e.Payload; return true; } code runs Smoothly ,But nothing happend after the Code executed. why? Can it interact with an asp control ?

— Reply to this email directly or view it on GitHub https://github.com/stevenlovegrove/MqttDotNet/issues/13.

muscle090620118 commented 9 years ago

Thanks for all. I had added a timer to client side to solve this problem, and it worked.