Skip to content

FLASH Native Wire Protocol

TCP binary protocol with BSON payloads for remote FLASH clients. Default port: 6744.


Server

javascript
import { FlashDatabase, FlashWireServer } from 'flash-zk';

const db = new FlashDatabase('wire_db', { storagePath: './data' });
const server = new FlashWireServer(db, {
  port: 6744,
  host: '127.0.0.1',
  replicaSet: 'flash_rs',
});

await server.start();

Commands

CommandDescription
flashHello / handshakeServer identity
pingHealth check
findQuery collection
insertInsert documents
update / deleteMutations
countCount matching docs
aggregatePipeline ($match, $project, $limit)
listCollectionsList collections
createIndexesCreate secondary indexes

Client

javascript
import { FlashWireClient } from 'flash-zk';

const client = new FlashWireClient('127.0.0.1', 6744);
const hello = await client.command({ flashHello: 1, $db: 'admin' });
const found = await client.command({
  find: 'users',
  filter: { name: 'Alice' },
  $db: 'wire_db',
});

FlashEdgeNode

Combined HTTP (6742) + wire (6744) edge daemon:

javascript
import { FlashEdgeNode } from 'flash-zk';

const edge = new FlashEdgeNode({
  storagePath: './edge_data',
  httpPort: 6742,
  wirePort: 6744,
  authKey: 'edge-secret',
});

await edge.start();

See also: Client-Server Mode, Protocols: gRPC & GraphQL.

Released under the Apache 2.0 License.