Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save LethalMaus/f2542662874b39c9d3b6bd75a7ec28aa to your computer and use it in GitHub Desktop.
ZeroMq.kt
private fun startReceiving() {
receiveJob = CoroutineScope(Dispatchers.IO).launch {
try {
while (isRunning && subSocket != null) {
val message = subSocket?.recvStr()
if (message != null) {
Log.d(TAG, "Server received message: $message")
messageCallback?.invoke(message)
}
}
} catch (e: Exception) {
Log.e(TAG, "Error receiving message: ${e.message}", e)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment