KinoUserPresence
is an Elixir module that provides user presence tracking functionality for Livebook applications. It
monitors user connections, tracks activity through heartbeats, and executes callbacks when users join or leave.
- Real-time user presence tracking
- Customizable join and leave callbacks
- Heartbeat mechanism to detect inactive users
Add kino_user_presence
to your list of dependencies in mix.exs
:
Mix.install(
[
{:kino_user_presence, "~> 0.1.0"}
]
)
To use KinoUserPresence
in your Livebook application:
Import the module:
KinoUserPresence.listen(
fn origin -> IO.puts("#{origin} joined") end,
fn origin -> IO.puts("#{origin} left") end
)
The module uses the following default configuration:
- Heartbeat interval: 100 milliseconds
- Grace period: 3 heartbeat intervals
You can modify these values by changing the module attributes in the source code.
To set up the project for development:
- Clone the repository
- Run mix deps.get to fetch dependencies
- Run mix test to execute the test suite
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the Apache License - see the LICENSE file for details.