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

DEFAULT_PROGRAM

src/datalink.js

const for fake program name for datalink id, seisplotjs

DEFAULT_PROGRAM

Type: string

DEFAULT_ARCH

src/datalink.js

const for fake architecture for datalink id, javascript

DEFAULT_ARCH

Type: string

const for error response, ERROR

ERROR

Type: string

PACKET

Type: string

STREAM

Type: string

ENDSTREAM

Type: string

MSEED_TYPE

Type: string

IRIS_RINGSERVER_URL

src/datalink.js
IRIS_RINGSERVER_URL

Type: string

DataLinkConnection

src/datalink.js

A websocket based Datalink connection to a ringserver. Currently only the IRIS ringserver, https://github.com/iris-edu/ringserver, supports websockets, but it may be possible to use thrid party tools to proxy the websocket to a TCP datalink socket. The datalink protocol is documented here 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
programname
username
architecture
_responseResolve
_responseReject
webSocket
setOnClose(closeHandler)
connect()
isConnected()
mode
stream()
endStream()
close()
sendId()
encodeDL(header, data?)
sendDLBinary(header, data?)
sendDLCommand(command, dataString?)
awaitDLBinary(header, data?)
awaitDLCommand(command, dataString?)
writeAck(streamid, hpdatastart, hpdataend, data?)
ensureDataLinkResponse(dl)
ensureDataLinkPacket(dl)
id(programname, username, processid, architecture)
info(infoType)
positionAfter(time)
positionAfterHPTime(hpTime)
match(pattern)
reject(pattern)
read(packetId)

DataLinkResponse

src/datalink.js

Datalink response, used for ID, INFO, OK and ERROR responses.

new DataLinkResponse(type: string, value: string, message: string)
Parameters
type (string)
value (string)
message (string)
Static Members
parse(header, data?)
Instance Members
type
value
message
toString()

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 hptime number to a moment.

hpTimeToMoment(hptime: number): moment
Parameters
hptime (number) hptime to convert
Returns
moment: moment in utc for the hptime

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.