Something that confused me when going through the tutorial the first time was how exactly chat_message() method was called. This PR attempts to make that more clear.
It also moves the type to use . notation, which is more in-align with both how the ASGI spec names types as well as the guidance later in the docs:
Any message sent to that channel name - or to a group the channel name was added to - will be received by the consumer much like an event from its connected client, and dispatched to a named method on the consumer. The name of the method will be the type of the event with periods replaced by underscores - so, for example, an event coming in over the channel layer with a type of chat.join will be handled by the method chat_join.
I think this change will help users more naturally flow from the tutorial into what is considered typical best practice for naming event types.
Something that confused me when going through the tutorial the first time was how exactly
chat_message()
method was called. This PR attempts to make that more clear.It also moves the
type
to use.
notation, which is more in-align with both how the ASGI spec names types as well as the guidance later in the docs:I think this change will help users more naturally flow from the tutorial into what is considered typical best practice for naming event types.