first event no callback
chakery opened this issue · comments
after subscribed channel, the first event not callback.
Which event are you looking for?
I think the channel doesn't subscribe for some reason, @danielrhodes. If so, I have the same issue many times
First of all, did you retain the channel somewhere? I kind of want to change the design of the library somewhat to make this not necessary as I used another realtime library and was unhappy with having a separate channel object.
@danielrhodes Actually having a separate Channel object is great. In our app we have Websocket object as a singleton at all times, and create Channel's on demand, whenever user needs them. This flow makes sense also because Starscream library seems to fail to cleanup properly, and crash when we recreate Websocket object =)
I am not, @danielrhodes. I have it like
var webSocketsRoomChannel: Channel {
let channelIdPayload = ["channel_id" : viewModel.channel?.identifier]
let channel = SocketRouter.shared.client.create(WebSocketEventsChannel.channel, identifier: channelIdPayload, autoSubscribe: true, bufferActions: true)
return channel
}
I also agree and have the same flow as @DenHeadless
Server-side to send the event changed to asynchronous, it is solved.