src/datalink.js

const for datalink protocol for web sockets, DataLink1.0

DATALINK_PROTOCOL

Type: string

const for query mode, QUERY

QUERY_MODE

Type: string

STREAM_MODE

src/datalink.js

const for streaming mode, STREAM

STREAM_MODE

Type: string

MAX_PROC_NUM

src/datalink.js

const for maximum process number to create fake number for datalink id, 2^16-2

MAX_PROC_NUM

USER_BROWSER

src/datalink.js

const for fake user name for datalink id, browser

USER_BROWSER

Type: string

const for error response, ERROR

ERROR

Type: string

PACKET

Type: string

STREAM

Type: string

ENDSTREAM

Type: string

MSEED_TYPE

Type: string

DataLinkConnection

src/datalink.js

A websocket based Datalink connection to a ringserver. https://raw.githubusercontent.com/iris-edu/libdali/master/doc/DataLink.protocol

new DataLinkConnection(url: string, packetHandler: function (packet: DataLinkPacket): void, errorHandler: function (error: Error): void)
Parameters
url (string) websocket url to the ringserver
packetHandler (function (packet: DataLinkPacket): void) callback for packets as they arrive
errorHandler (function (error: Error): void) callback for errors
Instance Members
packetHandler
errorHandler
closeHandler
serverId
clientIdNum
username
responseResolve
responseReject
webSocket
setOnClose(closeHandler)
connect()
isConnected()
mode
stream()
endStream()
close()
sendId()
encodeDL(command, data?)
sendDLBinary(header, data?)
sendDLCommand(command, dataString?)
awaitDLBinary(header, data?)
awaitDLCommand(command, dataString?)
writeAck(streamid, hpdatastart, hpdataend, data?)
handleError(error)

DataLinkPacket

src/datalink.js

Represents a Datalink packet from the ringserver. Note this cannot connect directly to a native TCP socket, instead it sends the datalink protocol over a websocket. Currently only the IRIS ringserver supports websockets, but it may be possible to use thrid party tools to proxy the websocket to a TCP datalink socket.

new DataLinkPacket(header: string, dataview: DataView)
Parameters
header (string)
dataview (DataView)
Instance Members
header
streamId
pktid
hppackettime
hppacketstart
hppacketend
dataSize
_miniseed
packetStart
packetEnd
packetTime
isMiniseed()
miniseed

momentToHPTime

src/datalink.js

Convert moment to a HPTime number.

momentToHPTime(m: moment): number
Parameters
m (moment) moment to convert
Returns
number: microseconds since epoch

hpTimeToMoment

src/datalink.js

Convert moment to a HPTime number.

hpTimeToMoment(hptime: number, m: any): moment
Parameters
hptime (number)
m (any) moment to convert
Returns
moment: microseconds since epoch

stringToUint8Array

src/datalink.js

Encode string into a Uint8Array.

stringToUint8Array(dataString: string?): (Uint8Array | void)
Parameters
dataString (string?) String to encode.
Returns
(Uint8Array | void): String as bytes in Uint8Array.