mitmedialab / django-channels-presence

"Rooms" and "Presence" for django-channels
MIT License
79 stars 38 forks source link

Error in documentation for Updating the “last_seen” timestamp #12

Closed luskbo closed 4 years ago

luskbo commented 6 years ago

Just came across an error in the documentation.

Under the section : "Updating the “last_seen” timestamp", there is an if statement for checking the heartbeat string.

from channels_presence.models import Presence
def ws_receive(message):
    ...
    if message.content('text') == '"heartbeat"':
        Presence.objects.touch(message.reply_channel.name)

Possibly a typo, but this generates a callable error. The correction is to just to change out the parentheses for brackets like this:

from channels_presence.models import Presence
def ws_receive(message):
    ...
    if message.content['text'] == '"heartbeat"':
        Presence.objects.touch(message.reply_channel.name)