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 a use case where I unsubscribe a channel and then subscribe again.
But somehow multiple duplicate response is received .
Below are my subscribe & unsubscribe methods
`
fun subscribeChannel() {
viewModelScope.launchWithException {
if (socketRepository.isSocketConnected) {
socketRepository.subscribeChannel(coinName, ChannelNameConstants.CHANNEL_ORDER_BOOK)
} else {
val socketFlow = socketRepository.getWebSocketEvents()
socketFlow.collect {
when (it) {
is WebSocket.Event.OnConnectionOpened<*> -> {
socketRepository.isSocketConnected = true
socketRepository.subscribeChannel(coinName, ChannelNameConstants.CHANNEL_ORDER_BOOK)
}
is WebSocket.Event.OnConnectionClosed,
is WebSocket.Event.OnConnectionFailed -> {
socketRepository.isSocketConnected = false
}
}
}
}
}
}
fun unsubscribeChannel(coinName: String, channelName: String) {
socketService.sendUnsubscribe(
ChannelData(
channelName = "$channelName ${SubscriptionType.UNSUBSCRIBE.value}",
data = coinName
)
)
}
`
The text was updated successfully, but these errors were encountered:
I have a use case where I unsubscribe a channel and then subscribe again.
But somehow multiple duplicate response is received .
Below are my subscribe & unsubscribe methods
`
The text was updated successfully, but these errors were encountered: