import { DataRecord } from "./miniseed.mjs";
import { DateTime } from "luxon";
export declare const WS_SEEDLINK3_SUBPROTOCOL = "SeedLink3.1";
export type SequencedDataRecord = {
rawsequence: string;
sequence: number;
miniseed: DataRecord;
};
/**
* A seedlink websocket connection to the given url.
* The connection is not made until the connect() method is called.
* Note this cannot connect directly to a native TCP socket, instead it
* sends the seedlink protocol over a websocket. Currently only the IRIS
* ringserver, https://github.com/iris-edu/ringserver,
* supports websockets, but it may be possible to use third party
* tools to proxy the websocket to a TCP seedlink socket.
*
* The seedlink (ver 3) protocol does not have an official spec document, but
* some details are here:
* https://www.seiscomp.de/doc/apps/seedlink.html
*
* @param url websocket URL to connect to
* @param requestConfig an array of seedlink commands
* like:
* [ 'STATION JSC CO',
* 'SELECT 00BHZ.D' ]
*
* @param receiveMiniseedFn the callback function that
* will be invoked for each seedlink packet received
* which contains 'sequence', a sequence number
* and 'miniseed', a single miniseed record.
*/
export declare class SeedlinkConnection {
url: string;
requestConfig: Array;
receiveMiniseedFn: (packet: SequencedDataRecord) => void;
errorHandler: (error: Error) => void;
logCommandFn: null | ((cmd: string) => void);
closeFn: null | ((close: CloseEvent) => void);
webSocket: null | WebSocket;
subprotocol: string | Array;
command: string;
helloLines: Array;
constructor(url: string, requestConfig: Array, receiveMiniseedFn: (packet: SequencedDataRecord) => void, errorHandler: (error: Error) => void);
setTimeCommand(startTime: DateTime): void;
setOnError(errorHandler: (error: Error) => void): void;
setOnClose(closeFn: (close: CloseEvent) => void): void;
connect(): Promise;
interactiveConnect(): Promise;
close(): void;
handle(event: MessageEvent): void;
handleMiniseed(data: ArrayBufferLike): void;
isConnected(): boolean;
/**
* Sends initial HELLO to server and waits for response.
*
* @returns Promise that resolves to the response from the server.
*/
sendHello(): Promise<[string, string]>;
/**
* Sends an array of commands, each as a Promise waiting for the 'OK' response
* before sending the next.
*
* @param cmd array of commands to send
* @returns Promise that resolves to the 'OK' returned by the last
* command if successful, or rejects on the first failure.
*/
sendCmdArray(cmd: Array): Promise;
/**
* creates a Promise that sends a command and waits resolved with the result.
*
* @param mycmd command string to send.
* @returns Promise that resolves to the reply from the server.
*/
createCmdPromise(mycmd: string): Promise;
/**
* handle errors that arise
*
* @private
* @param error the error
*/
handleError(error: Error): void;
}
//# sourceMappingURL=seedlink.d.mts.map