Comments (2)
How can I catch the fact that I have to re-connect. I'm currently wrapping nmqtt in a try-catch block but I cannot catch the fact that nmqtt is disconnected in order to do a dispose and reconnect (I've tested by shutting down the MQTT-broker)
{UnhandledExceptionController_Framework} -- -- 2013-11-27 08:55:30 -- Exception:
System.ObjectDisposedException
Level 1) Cannot access a disposed object.
Object name: 'System.Net.Sockets.NetworkStream'.
StackTrace for Level 1:
at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at Nmqtt.MqttConnection.Send(Byte[] message)
at Nmqtt.MqttConnection.Send(Stream message)
at Nmqtt.MqttConnectionHandler.SendMessage(MqttMessage message)
at Nmqtt.MqttConnectionKeepAlive.PingRequired(Object state)
at System.Threading._TimerCallback.TimerCallback_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading._TimerCallback.PerformTimerCallback(Object state)
Appreciate the help :-)
from nmqtt.
Unfortunately there is no nice way of doing this at the moment.
The connection state is exposed on the MqttClient class and you can monitor that, but there is no pro-active notification. Itβs a big hole I need to fill!
On Wednesday, 27 November 2013 at 08:26, Peter wrote:
How can I catch the fact that I have to re-connect. I'm currently wrapping nmqtt in a try-catch block but I cannot catch the fact that nmqtt is disconnected in order to do a dispose and reconnect (I've tested by shutting down the MQTT-broker)
{UnhandledExceptionController_Framework} -- -- 2013-11-27 08:55:30 -- Exception:
System.ObjectDisposedException
Level 1) Cannot access a disposed object.
Object name: 'System.Net.Sockets.NetworkStream'.
StackTrace for Level 1:
at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at Nmqtt.MqttConnection.Send(Byte[] message)
at Nmqtt.MqttConnection.Send(Stream message)
at Nmqtt.MqttConnectionHandler.SendMessage(MqttMessage message)
at Nmqtt.MqttConnectionKeepAlive.PingRequired(Object state)
at System.Threading.TimerCallback.TimerCallbackContext(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading._TimerCallback.PerformTimerCallback(Object state)
Appreciate the help :-)β
Reply to this email directly or view it on GitHub (#7 (comment)).
from nmqtt.
Related Issues (14)
- switch from using callbacks to events for message notification HOT 1
- Implement topic wildcard support HOT 1
- Restore .net 3.5 support HOT 1
- Report connection failure reasons to caller of Connect
- Strings >32k in length are not correctly decoded
- PublishingManager
- Can't build in Xamarin HOT 1
- How to auto reconnect
- used by webapi
- Implement reconnect + resubscribe for cases where TCP connection goes down.
- Update to correct handling of strings as UTF8
- Implement support for QOS Level 2
- MqttClient.cs can't handle large messages HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nmqtt.