npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

talklynk-sdk

v2.6.2

Published

Official TalkLynk SDK for video calling and chat integration

Readme

TalkLynk SDK

Official TypeScript/JavaScript SDK for integrating TalkLynk's video calling and chat capabilities into your applications.

Features

  • 🎥 Video Calling - High-quality WebRTC-based video calls
  • 💬 Real-time Chat - Instant messaging with typing indicators
  • 🖥️ Screen Sharing - Share your screen with participants
  • 🎙️ Audio Controls - Mute/unmute functionality
  • 📱 Mobile Ready - Full mobile device support
  • 🔒 Secure - End-to-end encrypted communications
  • 📊 Recording - Record video calls and conversations
  • 🎯 TypeScript - Full TypeScript support with type definitions

Installation

npm install talklynk-video-sdk

Quick Start

import TalkLynkSDK from 'talklynk-video-sdk';

// Initialize the SDK
const sdk = new TalkLynkSDK({
  apiKey: 'your-api-key',
  userId: 'user-123',
  userName: 'John Doe',
  serverUrl: 'https://sdk.talklynk.com/api' // optional
});

// Connect to TalkLynk servers
await sdk.connect({ audio: true, video: true });

// Join a room
const room = await sdk.joinRoom('room-id');

// Listen for events
sdk.on('participantJoined', (participant) => {
  console.log('New participant:', participant);
});

sdk.on('messageReceived', (message) => {
  console.log('New message:', message);
});

// Send a message
sdk.sendMessage({ type: 'text', content: 'Hello everyone!' });

🔗 Live Demo: https://sdk.talklynk.com/app 📖 Integration Guide: INTEGRATION.md

Configuration

TalkLynkConfig

interface TalkLynkConfig {
  apiKey: string;           // Your TalkLynk API key
  userId: string;           // Unique user identifier
  userName: string;         // Display name for the user
  serverUrl?: string;       // Optional server URL (defaults to https://sdk.talklynk.com/api)
  tenantId?: string;        // Optional tenant ID for multi-tenant applications
  pusher?: {                // Optional Pusher configuration for real-time messaging
    key: string;            // Pusher app key
    cluster: string;        // Pusher cluster (e.g., 'us2')
    forceTLS?: boolean;     // Force TLS (default: true)
  };
}

API Reference

Core Methods

connect(options?: ConnectionOptions): Promise<void>

Connect to TalkLynk servers and optionally request media permissions.

await sdk.connect({
  audio: true,    // Request microphone access
  video: true,    // Request camera access
  autoJoin: false // Automatically join last room
});

disconnect(): void

Disconnect from TalkLynk servers and clean up resources.

sdk.disconnect();

createRoom(roomData: Partial<Room>): Promise<Room>

Create a new room.

const room = await sdk.createRoom({
  name: 'My Meeting Room',
  type: 'video',
  settings: {
    maxParticipants: 10,
    recording: true
  }
});

joinRoom(roomId: string, options?: ConnectionOptions): Promise<Room>

Join an existing room.

const room = await sdk.joinRoom('room-123', {
  audio: true,
  video: true
});

leaveRoom(): Promise<void>

Leave the current room.

await sdk.leaveRoom();

Media Methods

getUserMedia(constraints: MediaStreamConstraints): Promise<MediaStream>

Get user media (camera/microphone).

const stream = await sdk.getUserMedia({
  video: true,
  audio: true
});

getDisplayMedia(): Promise<MediaStream>

Start screen sharing.

const screenStream = await sdk.getDisplayMedia();

toggleAudio(): boolean

Toggle microphone on/off. Returns the new state.

const isEnabled = sdk.toggleAudio();

toggleVideo(): boolean

Toggle camera on/off. Returns the new state.

const isEnabled = sdk.toggleVideo();

Chat Methods

sendMessage(message: Omit<Message, 'id' | 'timestamp' | 'userId' | 'userName'>): void

Send a message to the current room.

sdk.sendMessage({
  type: 'text',
  content: 'Hello everyone!'
});

Recording Methods

startRecording(): Promise<void>

Start recording the current room.

await sdk.startRecording();

stopRecording(): Promise<string>

Stop recording and get the recording URL.

const recordingUrl = await sdk.stopRecording();

Events

The SDK uses an event-driven architecture. Listen for events using the on method:

// Connection events
sdk.on('connected', () => console.log('Connected to TalkLynk'));
sdk.on('disconnected', () => console.log('Disconnected from TalkLynk'));

// Room events
sdk.on('roomJoined', (room) => console.log('Joined room:', room));
sdk.on('roomLeft', () => console.log('Left room'));

// Participant events
sdk.on('participantJoined', (participant) => console.log('Participant joined:', participant));
sdk.on('participantLeft', (participant) => console.log('Participant left:', participant));

// Media events
sdk.on('localStreamAvailable', (stream) => {
  // Attach local stream to video element
  const videoElement = document.getElementById('localVideo');
  videoElement.srcObject = stream;
});

sdk.on('remoteStreamAvailable', ({ participantId, stream }) => {
  // Attach remote stream to video element
  const videoElement = document.getElementById(`participant-${participantId}`);
  videoElement.srcObject = stream;
});

sdk.on('audioToggled', (enabled) => console.log('Audio:', enabled ? 'enabled' : 'disabled'));
sdk.on('videoToggled', (enabled) => console.log('Video:', enabled ? 'enabled' : 'disabled'));

// Chat events
sdk.on('messageReceived', (message) => console.log('New message:', message));

// Screen sharing events
sdk.on('screenShareStarted', (stream) => console.log('Screen sharing started'));
sdk.on('screenShareStopped', () => console.log('Screen sharing stopped'));

// Recording events
sdk.on('recordingStarted', () => console.log('Recording started'));
sdk.on('recordingStopped', (recordingUrl) => console.log('Recording saved:', recordingUrl));

// Error handling
sdk.on('error', (error) => console.error('SDK Error:', error));

TypeScript Interfaces

Room

interface Room {
  id: string;
  name: string;
  type: 'video' | 'audio' | 'chat';
  participants: Participant[];
  settings: RoomSettings;
}

Participant

interface Participant {
  id: string;
  name: string;
  avatar?: string;
  isHost: boolean;
  isLocalUser: boolean;
  stream?: MediaStream;
  audioEnabled: boolean;
  videoEnabled: boolean;
  screenShareEnabled: boolean;
}

Message

interface Message {
  id: string;
  type: 'text' | 'file' | 'system';
  content: string;
  userId: string;
  userName: string;
  timestamp: Date;
  metadata?: any;
}

RoomSettings

interface RoomSettings {
  audio: boolean;
  video: boolean;
  screenShare: boolean;
  chat: boolean;
  recording: boolean;
  maxParticipants: number;
}

Example: React Integration

import React, { useEffect, useState } from 'react';
import TalkLynkSDK, { Participant, Message } from 'talklynk-video-sdk';

function VideoCall() {
  const [sdk, setSdk] = useState<TalkLynkSDK | null>(null);
  const [participants, setParticipants] = useState<Participant[]>([]);
  const [messages, setMessages] = useState<Message[]>([]);
  const [localStream, setLocalStream] = useState<MediaStream | null>(null);

  useEffect(() => {
    const initSDK = async () => {
      const newSdk = new TalkLynkSDK({
        apiKey: 'your-api-key',
        userId: 'user-123',
        userName: 'John Doe'
      });

      // Set up event listeners
      newSdk.on('localStreamAvailable', setLocalStream);
      newSdk.on('participantJoined', (participant) => {
        setParticipants(prev => [...prev, participant]);
      });
      newSdk.on('messageReceived', (message) => {
        setMessages(prev => [...prev, message]);
      });

      await newSdk.connect({ audio: true, video: true });
      await newSdk.joinRoom('room-123');
      
      setSdk(newSdk);
    };

    initSDK();

    return () => {
      sdk?.disconnect();
    };
  }, []);

  return (
    <div>
      {/* Local video */}
      {localStream && (
        <video
          ref={(el) => { if (el) el.srcObject = localStream; }}
          autoPlay
          muted
          playsInline
        />
      )}

      {/* Remote participants */}
      {participants.map(participant => (
        <div key={participant.id}>
          {participant.stream && (
            <video
              ref={(el) => { if (el) el.srcObject = participant.stream; }}
              autoPlay
              playsInline
            />
          )}
          <p>{participant.name}</p>
        </div>
      ))}

      {/* Controls */}
      <button onClick={() => sdk?.toggleAudio()}>Toggle Audio</button>
      <button onClick={() => sdk?.toggleVideo()}>Toggle Video</button>
      <button onClick={() => sdk?.leaveRoom()}>Leave Room</button>
    </div>
  );
}

Error Handling

The SDK provides comprehensive error handling through the error event:

sdk.on('error', (errorData) => {
  switch (errorData.type) {
    case 'connection':
      console.error('Connection error:', errorData.error);
      break;
    case 'media':
      console.error('Media access error:', errorData.error);
      break;
    case 'socket':
      console.error('Socket error:', errorData.error);
      break;
    case 'screenshare':
      console.error('Screen share error:', errorData.error);
      break;
    default:
      console.error('Unknown error:', errorData.error);
  }
});

Browser Support

  • Chrome 70+
  • Firefox 70+
  • Safari 14+
  • Edge 80+

Requirements

  • Node.js 16+
  • Modern browser with WebRTC support
  • HTTPS (required for media access)

Getting Your API Key

  1. Visit the TalkLynk Client Portal
  2. Create an account or sign in
  3. Navigate to API Keys section
  4. Generate a new API key for your application

Support

  • 📧 Email: [email protected]
  • 📖 Documentation: https://docs.talklynk.com
  • 🐛 Issues: https://github.com/talklynk/sdk/issues

License

MIT License - see LICENSE file for details.