- Docs
- Getting Started
- Quickstart
Quickstart
Get started with QPub in minutes using our quickstart guide.
Prerequisites
- QPub account (sign up at qpub.com)
- Basic knowledge of JavaScript/TypeScript
Step 1: Get Your API Key
- Sign up for a QPub account
- Navigate to your dashboard
- Generate an API key from the API Keys section
- Copy your API key for use in your application
Step 2: Install the SDK
npm install @qpub/sdkStep 3: Create Your First Connection
import { QPubSocket } from '@qpub/sdk';
const client = new QPubSocket({
apiKey: 'your-api-key-here'
});
// Connect to QPub
await client.connect();Step 4: Subscribe to a Channel
// Subscribe to receive messages
client.subscribe('my-channel', (message) => {
console.log('Received message:', message);
});Step 5: Publish Your First Message
// Publish a message to the channel
await client.publish('my-channel', {
text: 'Hello, QPub!',
timestamp: new Date().toISOString()
});Complete Example
import { QPubSocket } from '@qpub/sdk';
async function main() {
// Initialize client
const client = new QPubSocket({
apiKey: 'your-api-key-here'
});
// Connect
await client.connect();
console.log('Connected to QPub!');
// Subscribe to channel
client.subscribe('demo-channel', (message) => {
console.log('Received:', message);
});
// Publish message
await client.publish('demo-channel', {
text: 'Hello from my QPub app!',
author: 'quickstart-user'
});
console.log('Message sent!');
}
main().catch(console.error);Next Steps
- Explore the APIs documentation
- Learn about SDKs
- Check out Channel usage
- Read about Authentication
This page is under construction. Quickstart guide will be expanded soon.
Previous
Using QPub
Next
Choose an SDK