@ethersphere/bee-js
Version:
Javascript client for Bee
24 lines (23 loc) • 924 B
TypeScript
/// <reference types="ws" />
import WebSocket from 'isomorphic-ws';
import type { BeeRequestOptions } from '../types';
import { BatchId, PublicKey, Topic } from '../utils/typed-bytes';
/**
* Send to recipient or target with Postal Service for Swarm
*
* @param requestOptions Options for making requests
* @param topic Topic name
* @param target Target message address prefix
* @param data
* @param postageBatchId Postage BatchId that will be assigned to sent message
* @param recipient Recipient public key
*
*/
export declare function send(requestOptions: BeeRequestOptions, topic: Topic, target: string, data: string | Uint8Array, postageBatchId: BatchId, recipient?: PublicKey): Promise<void>;
/**
* Subscribe for messages on the given topic
*
* @param url Bee node URL
* @param topic Topic name
*/
export declare function subscribe(url: string, topic: Topic, headers?: Record<string, string>): WebSocket;