1.0.0-alpha.15 • Published 3 years ago

ed-tracker v1.0.0-alpha.15

Weekly downloads
-
License
GPL-3.0-or-later
Repository
github
Last release
3 years ago

ED-Tracker

This is an pre-release of this Package for testing its functionality, please do not download it unless told to do

An module to track EliteDangerous Data with DK Servers

This was made for our Group who you can find here: ED Guilded For more info contact us here


This Tracker requires the edreader package by @fightingdoggo

To Install it: npm i @fightingdoggo/edreader

Installation

npm install ed-tracker

Docs

D - Depricated

Sidenote: The script also creates an file called log.txt for any messages logged and received

login(Key)

The login Function is used to connect to the Server using an API Key given out in our before mentioned Guilded Server.

Example:

EDTracker.login('Your_API-Key_Here')

events

Deprecated, now listen on the EDTracker itself!

Exists for Backwards compatibility only, and might not be included in future versions

The events EventStream is used to read Data from the Incoming connections and logs from internal scripts

There are 2 Types of Events so far: | Event | Data | |:-----:| ---- | | data | Data is used for sending Debug Info and Errors from the script, as of now these are not separated yet | | error | The Error Event is used for sending errors from the Script and should always be listened at |

| message | The Message Event is used for receiving Data from the Server side. These can be Infos for the connection to the Server, upcoming events or acknowledge that an request was successful |

Example:

const Tracker = new EDTracker
const stream = Tracker.events

// log Info and Errors in console with "data"
stream.on("data", data)

send(data)

The Send Function is used to directly send data to the Server. Due to how it is processed, it is recommended to not to send Data directly to the Server to get a valid response. For more info for how the data is processed contact us here.

Example:

EDTracker.send("Ping")
// The server would now send an message event with the data "Pong"

appendStream(stream, event)

AppendStream is used to append an edreader EventStream to this instance of EDTracker. This will then automatically send all Journal Entries to the Server to be processed.

Do not use this if you are manually sending data with EDTracker.send()

Example:

let Tracker = new EDTracker
let Reader = require('@fightingdoggo/edreader') //v1.0.4 or higher
Reader.startAll() // starts all Listeners
Tracker.appendStream(Reader, 'allData')
// will send all Events to the Server

For all events see: https://www.npmjs.com/package/@fightingdoggo/edreader

Listening for Events

To Receive Events simply listen for events on the main class:

EDTracker.on("Event_Name", data => {
    console.log(data)
})

There are 2 Types of Events so far: | Event | Data | |:-----:| ---- | | data | Data is used for sending Debug Info and Errors from the script, as of now these are not separated yet | | error | The Error Event is used for sending errors from the Script and should always be listened at | | message | The Message Event is used for receiving Data from the Server side. These can be Infos for the connection to the Server, upcoming events or acknowledge that an request was successful |