Skip to content

Daphne ping pong #496

Answered by carltongibson
Producks asked this question in Q&A
Jan 21, 2024 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Hi.

I assuming you're using something like the PingConsumer from the Channels docs...

class PingConsumer(AsyncConsumer):
    async def websocket_connect(self, message):
        await self.send({
            "type": "websocket.accept",
        })

    async def websocket_receive(self, message):
        await asyncio.sleep(1)
        await self.send({
            "type": "websocket.send",
            "text": "pong",
        })

If so, you can add some logging (or print output even) to websocket_receive to show the events in action.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Producks
Comment options

Answer selected by Producks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants