@oriient/session-emulator v0.4.39
@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})
Param | Description |
---|---|
ipsAddress | Address of real time server to emulate against. Env var: IPS_ADDRESS. Default: ws://ipspp.oriient.me |
mongoUri | URI for the mongodb access. Env var: MONGO_URI. Default: production mongodb |
username | Username to send to the server. Default: RealTimeSessionEmulator |
recordsBucket | The bucket name where the session records exist. Env var: RECORDS_BUCKET. Defualt: production buckcet |
sessionIdToEmulate | The sessionId to emulate against the server. No default, you must supply. |
msgTimeout | The 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'
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago