Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

Simple presence boilerplate for django-channels 2 and channel redis backend.

Project description

**django-channels-presence2**

Simple presence boilerplate for django-channels 2 and channel redis backend.

**Installation**

`pip install django-channels-presence2`

**Usage**

Create presence for consumer:

`self.presence = await ChannelPresence.create_from_consumer(self, groups=(PUBLICATIONS_SCHEDULE_GROUP,))`

Example of create:

`class Consumer(AsyncJsonWebsocketConsumer):
async def connect(self):
self.presence = await ChannelPresence.create_from_consumer(self, groups=(CONSUMER_GROUP,))`

Groups are needed to send join and leave messages.
Learn more about groups: http://channels.readthedocs.io/en/latest/topics/channel_layers.html?highlight=group_send.

Join user:

`await self.presence.join()`

Leave user:

`await self.presence.leave()`

Get users:

`await self.presence.get_users(GROUP)`

Return:

`{
'user': SimpleLazyObject of User,
'is_active': True or False
'present_at': Datetime
}`

To set the activity expired time use `EXPIRED_USER_ACTIVITY` in django settings.

Project details


Release history Release notifications

This version
History Node

0.0.4a0

History Node

0.0.3a0

History Node

0.0.2a0

History Node

0.0.1a0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
django_channels_presence2-0.0.4a0-py3-none-any.whl (4.9 kB) Copy SHA256 hash SHA256 Wheel py3 Mar 11, 2018
django-channels-presence2-0.0.4a0.tar.gz (2.6 kB) Copy SHA256 hash SHA256 Source None Mar 11, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page