0.1.1 • Published 8 months ago

online-new v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

Original online package. MIT License

Track online user activity with redis.

Example

import online from 'online-new';
import {createClient} from 'redis';

const db = await createClient()
  .on('error', err => console.log('Redis Client Error', err))
  .connect();

// use the given redis client
const onlineDb = online(db);

// later in middleware or somewhere in your
// application add these calls to track activity:
await onlineDb.add(user.id);

// get users active in the last 10 minutes
await users = onlineDb.last(10);

API

Online.add(id)

Add a user id to the active minute-level set.

Online.clear()

Clear all activity tracking, useful for tests etc.

Online.last(n)

Get activity in the last n minutes.

0.1.1

8 months ago

0.1.0

8 months ago

0.0.4

9 months ago

0.0.3

9 months ago

0.0.2

9 months ago