You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have socket cluster client setup as described in the documents. I start the service to listen the changes and stop it when I dont want to listen. My issue is after stopping the service as well I receive data. Either there is another way to stop listening or there is a bug in the library. I have posted the code here.
class SocketForSecurityAgents : IntentService(SocketForSecurityAgents::javaClass.name), BasicListener, AnkoLogger {
override fun onCreate() {
super.onCreate()
info { "onCreate:" }
}
override fun onHandleIntent(intent: Intent?) {
info { "onHandleIntent socket: ${SERVER_URL + cobaltStore?.token}" }
val socket = Socket(SERVER_URL + cobaltStore?.token)
socket.setListener(this)
socket.setReconnection(ReconnectStrategy().setDelay(2000).setMaxAttempts(30))
socket.connect()
channel = socket.createChannel(channelName)
channel?.subscribe { name, error, data ->
info { "Subscribe: name: $name" }
info { "Subscribe: error: $error" }
info { "Subscribe: data: $data" }
}
channel?.onMessage { name, data ->
info { "name: $name" }
info { "data: $data" }
}
}
override fun onDestroy() {
super.onDestroy()
info { "onDestroy" }
}
}
In my fragmnet I start and stop this service like this.
When service is running to listen from socket, it gives onCreate logs on starting, logs in between in onHandleInten method also I see onDestroy when I stop the service.
My issue is I still receive messages in onHandleIntent after destroying service. Please let me know how to stop listening to channel. These are the logs
I have socket cluster client setup as described in the documents. I start the service to listen the changes and stop it when I dont want to listen. My issue is after stopping the service as well I receive data. Either there is another way to stop listening or there is a bug in the library. I have posted the code here.
In my fragmnet I start and stop this service like this.
When service is running to listen from socket, it gives
onCreate
logs on starting, logs in between inonHandleInten
method also I seeonDestroy
when I stop the service.My issue is I still receive messages in
onHandleIntent
after destroying service. Please let me know how to stop listening to channel. These are the logsThe text was updated successfully, but these errors were encountered: