Package Exports
- queuedb
- queuedb/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (queuedb) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
DroneQ
A lightweight and fast queue database server with WebSocket support for real-time data streaming.
Installation
npm install droneqQuick Start
import { QDB, QDBServer } from 'droneq';
// Create a new QDB server
const server = new QDBServer("MyApp", {
port: 3000,
});
// Create a new database instance
const db = new QDB("mydb", {
username: "root",
password: "",
});
// Mount the database to the server
server.mountDb(db);
// Start the server
server.listen();API Documentation
QDBServer
The main server class that handles WebSocket connections and database management.
Constructor
new QDBServer(name: string, options: {
port: number;
host?: string;
path?: string;
})name: The name of your applicationoptions: Server configuration optionsport: The port number to listen onhost: (Optional) The host to bind to (defaults to 'localhost')path: (Optional) The WebSocket path (defaults to '/ws')
Methods
mountDb(db: QDB): Mount a database instance to the serverlisten(): Start the server and begin accepting connections
QDB (Queue Database)
The database class that handles queue-based data storage and retrieval.
Constructor
new QDB(name: string, options: {
username: string;
password: string;
})name: The name of your databaseoptions: Database configuration optionsusername: Database usernamepassword: Database password
Queue Operations
The QDB class provides methods for queue-based operations:
enqueue(queueName: string, data: any): Add an item to the end of a queuedequeue(queueName: string): Remove and return the first item from a queuepeek(queueName: string): View the first item in a queue without removing itqueueLength(queueName: string): Get the current length of a queueclearQueue(queueName: string): Clear all items from a queue
Features
- Queue-based data storage and retrieval
- WebSocket-based real-time communication
- SQLite backend for reliable data persistence
- TypeScript support with full type definitions
- Authentication support
- Event-based architecture
- Real-time queue updates to connected clients
Use Cases
- Message queues
- Task processing systems
- Real-time data streaming
- Event logging
- Job scheduling
- Data buffering
Development
# Install dependencies
npm install
# Start development server
npm run dev
# Build the project
npm run build
# Run tests
npm testLicense
MIT
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.