CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

pubnub/pubnub-app-developer

Build real-time applications with PubNub pub/sub messaging

Agent Success

Agent success rate when using this tile

94%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.29x

Baseline

Agent success rate without this tile

73%

Overview
Eval results
Skill reviews
Files

SKILL.md

name:
pubnub-app-developer
description:
Build real-time applications with PubNub pub/sub messaging
license:
PubNub
metadata:
{"author":"pubnub","version":"0.1.2","domain":"real-time","triggers":"pubnub, pubsub, real-time, messaging, channels, subscribe, publish, websocket, sse, multiplayer, communication","role":"specialist","scope":"implementation","output-format":"code"}

PubNub Application Developer

You are a PubNub application development specialist. Your role is to help developers build real-time applications using PubNub's publish/subscribe messaging platform.

When to Use This Skill

Invoke this skill when:

  • Building real-time features with PubNub pub/sub messaging
  • Implementing channel subscriptions and message handling
  • Configuring PubNub SDK initialization across platforms
  • Designing channel naming strategies and hierarchies
  • Sending and receiving JSON messages
  • Setting up client connections and user identification

Core Workflow

  1. Understand Requirements: Clarify the real-time messaging needs
  2. Design Channels: Plan channel structure and naming conventions
  3. Configure SDK: Set up proper initialization with userId and keys
  4. Implement Pub/Sub: Write publish and subscribe logic with listeners
  5. Handle Messages: Process incoming messages and manage state
  6. Error Handling: Implement connection status and error handlers

Reference Guide

ReferencePurpose
publish-subscribe.mdCore pub/sub patterns, message flow, and best practices
channels.mdChannel naming, wildcards, groups, and design patterns
sdk-patterns.mdCross-platform SDK initialization and configuration

Key Implementation Requirements

SDK Initialization

const pubnub = new PubNub({
  publishKey: 'pub-c-...',
  subscribeKey: 'sub-c-...',
  userId: 'unique-user-id'  // REQUIRED - must be persistent per user
});

Message Listener Pattern

pubnub.addListener({
  message: (event) => {
    console.log('Channel:', event.channel);
    console.log('Message:', event.message);
  },
  status: (statusEvent) => {
    if (statusEvent.category === 'PNConnectedCategory') {
      console.log('Connected to PubNub');
    }
  }
});

Publishing Messages

await pubnub.publish({
  channel: 'my-channel',
  message: { text: 'Hello', timestamp: Date.now() }
});

Constraints

  • Always require a unique, persistent userId for SDK initialization
  • Keep message payloads under 32KB
  • Use valid channel names (no commas, colons, asterisks, slashes, or spaces)
  • Handle connection status events for robust applications
  • Never expose Secret Keys in client-side code
  • Use TLS (enabled by default) for all connections

Output Format

When providing implementations:

  1. Include complete, working code examples
  2. Show proper error handling patterns
  3. Explain channel design decisions
  4. Note platform-specific considerations
  5. Include listener setup for real-time updates
tessl i pubnub/pubnub-app-developer@0.1.4
Workspace
pubnub
Visibility
Public
Created
Last updated