Socket io with Dagger Hilt Code Snippet Declare with lateinit var @Inject lateinit var socketManager: SocketManager Call the socketConnect method on onStart override fun onStart() { super.onStart() socketManager.socketConnect() } Call the socketDisconnect method on onDestroy override fun onDestroy() { super.onDestroy() socketManager.socketDisconnect() } File Strature Socket event on / off call private fun socketOn() { socketOff() mSocket.on(TRANSACTION_EVENT, listeners.onTransactionsListening) } private fun socketOff() { mSocket.off(TRANSACTION_EVENT) } We will get call back into this Emitter Listener var onTransactionsListening = Emitter.Listener { args: Array<Any> -> try { val messageJson = JSONObject(args[0].toString()) Log.d( TAG, "SocketHelper setListening: json---- $messageJson" ) } catch (e: JSONException) { Log.d( TAG, "SocketHelper call: error " + e.message ) e.printStackTrace() } } Socket io graph