0.4.39 • Published 2 years ago

@oriient/session-emulator v0.4.39

Weekly downloads
7
License
ISC
Repository
gitlab
Last release
2 years ago

@oriient/session-emulator

Package for emulating sessions against our real time server

Basic usage

Can be used for monitoring or stress testing. Simple example:

const getEmulator = require('@oriient/session-emulator');

const emulator = getEmulator({
    username: "emulatorYeuhdaIOS",
    sessionIdToEmulate: "5697946a-57a2-42f1-9715-0fe19c761629"
  });

await emulator.runFullSession();

API reference

In general, you can call functions to perform actions against the server and listen to events (the emulator is EventEmmiter) in order to gain more control over the emulation. There is also the convience method of runFullSession to run the whole session without intervention.

getEmulator({ipsAddress, mongoUri, username, recordsBucket, sessionIdToEmulate, msgTimeout})

ParamDescription
ipsAddressAddress of real time server to emulate against. Env var: IPS_ADDRESS. Default: ws://ipspp.oriient.me
mongoUriURI for the mongodb access. Env var: MONGO_URI. Default: production mongodb
usernameUsername to send to the server. Default: RealTimeSessionEmulator
recordsBucketThe bucket name where the session records exist. Env var: RECORDS_BUCKET. Defualt: production buckcet
sessionIdToEmulateThe sessionId to emulate against the server. No default, you must supply.
msgTimeoutThe timeout for a message to get response from the server. Env var: MSG_TIMEOUT. Default: 30000 ms

async runFullSession()

Convienient function to run a full session.

async connectToRTS()

Connect to RTS

Emit event: 'ws-open'

async login()

Perform login against server. The api key that will be used is by the emulates session id as the metadata of the session record. Returns once 'loginAck' message arrived back.

Emit event: 'login-success'

async startPositioning()

Starts positioning. Returns once 'positioning' message arrive. This does not start sending data yet.

Emit event: 'start-positioning-success'

async startStreamingSessionData()

Starts sending binary data to the engine. As a result position updates will start to arrive.

Emit events:

  • 'position-update' for each position update
  • 'frame-sent' for each frame being sent
  • 'session-data-stream-end' when streaming of the data is over

async stopPositioning()

Stops the positioning. Returns after 'stopped' arrived.

Emit event: 'stop-positioning-success'

async logout()

Performs logout. Returns once 'logoutResp' message arrived.

Emit event: 'logout-success'

stopStreamingSessionData()

Stops the streaming of the session data. Does not stop the session.

Emit event: 'session-data-stream-stopped'

0.4.39

2 years ago

0.4.37

2 years ago

0.4.38

2 years ago

0.4.35

2 years ago

0.4.36

2 years ago

0.4.20

3 years ago

0.4.21

3 years ago

0.4.28

3 years ago

0.4.29

3 years ago

0.4.26

3 years ago

0.4.27

3 years ago

0.4.24

3 years ago

0.4.22

3 years ago

0.4.23

3 years ago

0.4.19

3 years ago

0.4.31

3 years ago

0.4.32

3 years ago

0.4.30

3 years ago

0.4.17

3 years ago

0.4.18

3 years ago

0.4.15

3 years ago

0.4.13

3 years ago

0.4.14

3 years ago

0.4.34

2 years ago

0.4.9

3 years ago

0.4.8

3 years ago

0.4.10

3 years ago

0.4.11

3 years ago

0.4.12

3 years ago

0.4.5

3 years ago

0.4.4

3 years ago

0.4.7

3 years ago

0.4.6

3 years ago

0.4.3

3 years ago

0.4.1

3 years ago

0.4.2

3 years ago

0.4.0

4 years ago

0.3.6

4 years ago

0.3.5

4 years ago

0.3.4

4 years ago

0.3.2

4 years ago

0.3.1

4 years ago

0.3.3

4 years ago

0.3.0

4 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago