Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions nmqtt.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1216,6 +1216,11 @@ proc unsubscribe*(ctx: MqttCtx, topic: string): Future[void] =
ctx.workQueue[msgId] = Work(wk: SubWork, msgId: msgId, topic: topic, typ: Unsubscribe)
result = ctx.work()

proc isErrored*(ctx: MqttCtx): bool =
## Returns true, if the context is in an error state
if ctx.state == Error:
result = true

proc isConnected*(ctx: MqttCtx): bool =
## Returns true, if the client is connected to the broker.
if ctx.state == Connected:
Expand Down