liveview-native/phoenix-channels-client

Phoenix.Channels: phx_close does not change the state of the channel::Listener

Closed this issue · 0 comments

When a phx_close push is sent to the socket::Listener

async fn handle_push(&self, push: Push) {
debug!("received push: {:#?}", &push);
if let Some(JoinedChannelSenders { push: push_tx, .. }) = self
.joined_channel_txs_by_join_reference_by_topic
.get(&push.topic)
.and_then(|push_tx_by_reference| push_tx_by_reference.get(&push.join_reference.clone()))
{
push_tx.send(push).await.ok();
}
}

[2023-09-14T21:11:34Z DEBUG phoenix_channels_client::socket::listener] received push: Push {
        topic: "channel:protected",
        event_payload: EventPayload {
            event: Phoenix(
                Close,
            ),
            payload: Value(
                Object {},
            ),
        },
        join_reference: "ADD2C411-A58A-47A9-9BF8-315DE909ABB1",
        reference: Some(
            "ADD2C411-A58A-47A9-9BF8-315DE909ABB1",
        ),
    }

it calls push_tx.send(push).await.ok(), which the channel::Listener receives

Some(push) = joined.push_rx.recv() => {
self.send_event_payload(push);
State::Joined(joined)
}

But, since the returned State is always State::Joined, nothing happens to show the phx_close came to channel and should rejoin.