Socket SDK Constructor

Initialize and configure the QPub Socket SDK.

Overview

The Socket SDK constructor creates a new instance of the QPub client for real-time communication.

Basic Usage

import { QPubSocket } from '@qpub/sdk';

const client = new QPubSocket({
  apiKey: 'your-api-key',
  endpoint: 'wss://api.qpub.com'
});

Constructor Options

Required Parameters

  • apiKey: Your QPub API key for authentication

Optional Parameters

  • endpoint: WebSocket endpoint URL (defaults to production)
  • autoConnect: Automatically connect on initialization
  • reconnect: Enable automatic reconnection
  • timeout: Connection timeout in milliseconds

Configuration Examples

Basic Configuration

const client = new QPubSocket({
  apiKey: 'your-api-key'
});

Advanced Configuration

const client = new QPubSocket({
  apiKey: 'your-api-key',
  endpoint: 'wss://api.qpub.com',
  autoConnect: true,
  reconnect: true,
  timeout: 30000
});

This page is under construction. Socket SDK constructor documentation will be expanded soon.