Skip to content

Instantly share code, notes, and snippets.

@LethalMaus
Created February 11, 2026 19:59
Show Gist options
  • Select an option

  • Save LethalMaus/4c17d4d672429766839a338f82d1df0b to your computer and use it in GitHub Desktop.

Select an option

Save LethalMaus/4c17d4d672429766839a338f82d1df0b to your computer and use it in GitHub Desktop.
ZeroMq.kt
override fun close() {
try {
isRunning = false
receiveJob?.cancel()
subSocket?.close()
pubSocket?.close()
context?.close()
Log.d(TAG, "Disconnected from server")
CoroutineScope(Dispatchers.Main).launch { onConnectionChanged?.invoke(false) }
} catch (e: Exception) {
Log.e(TAG, "Error disconnecting from server: ${e.message}", e)
} finally {
receiveJob = null
subSocket = null
pubSocket = null
context = null
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment