0.0.2 • Published 7 months ago

@roostly/js v0.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

Roostly JavaScript SDK

A lightweight JavaScript SDK for Roostly, a Pusher-compatible WebSocket service.

Installation

npm install @roostly/js

Usage

import { Roostly } from '@roostly/js';

// Initialize the client
const client = new Roostly({
  key: 'your_app_key',
  host: 'your-server-host.com',
  secure: true,
  enableLogging: true
});

// Subscribe to a channel
const channel = client.subscribe('my-channel');

// Bind to an event on the channel
client.bind('my-channel', 'new-message', (data) => {
  console.log('New message received:', data);
});

// Listen for connection events
client.on('connection_established', (event) => {
  console.log('Connected with socket ID:', event.data.socketId);
});

Features

  • WebSocket connection management
  • Channel subscriptions
  • Event binding
  • Automatic reconnection
  • Lightweight (only 45KB)

License

MIT

0.0.2

7 months ago

0.0.1-0

8 months ago