npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@oriient/session-emulator

v2.4.0

Published

Enables real time session emulation against real time server

Downloads

42,101

Readme

@oriient/session-emulator

Package for emulating sessions against our Backend, either with remote engine or OnDevice engine

Basic usage

Can be used for monitoring or stress testing, or performing sessions from a developer machine. There are three modes that the emulator can be used: ###1. OnDevice simulation In this mode, the emulation will behave as OnDevice SDK. It will call all the REST API calls and will upload sensors / positions / events / validation chunks. It also has the ability to perform dummy "EventTags" (see options below). ####1.1 with pre-saved session data (default) In this mode, the session data is pre-saved. No need in MongoDB communication or GCP bucket access. You must supply the "oriientEnv" parameter. ######Usage example

const { sessionEmulator: getEmulator, Envs } = require('@oriient/session-emulator');

const emulator = getEmulator({
    username: 'session-emulator-ondevice',
    oriientEnv: Envs[envName],
});

emulator.runFullSession(); // will run a full session flow

####1.2 with DB session data In this mode, the session data will be pulled from the MongoDB and GCP buckets. You must have MongoDB communication (don't forget VPN) and GCP bucket access. The env that the session will be performed against will be decided by the sessionId details. Make sure the originalSessionId you provide indeed exist in the MongoDB URI you are providing. ######Usage example

const { sessionEmulator: getEmulator, Envs } = require('@oriient/session-emulator');

const emulator = getEmulator({
    username: 'session-emulator-ondevice',
    originalSessionId: '862984f6-a6e1-4fa3-9262-b3bf37dd2663',
});

emulator.runFullSession(); // will run a full session flow

###2. Remote Engine simulation In this mode, the emulation will be performed against the RTS, like an old SDK. In this mode, pre-saved data is not supported, only supplying originalSessionId. You can perform either positioning or calibration. You must have MongoDB communication (don't forget VPN) and GCP bucket access. It does NOT have the ability to perform dummy "EventTags". You must supply ipsAddress in order to perform the session against it. ######Usage example

const { sessionEmulator: getEmulator, Envs } = require('@oriient/session-emulator');

const emulator = getEmulator({
    username: 'emulatorPackageTest',
    originalSessionId: '789d95fa-5d62-4db7-9f11-bbcd7d284223',
    ipsAddress: 'wss://ips.oriient.me',
    simulateOnDevice: false,
});

emulator.runFullSession(); // will run a full session flow

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 convince method of runFullSession to run the whole session without intervention.

getEmulator(options: Object)

The options objects can contain the following properties:

| Param | Description | |-----------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------| | simulateOnDevice | Whether to simulate OnDevice session. Default true. If false / not supplied will simulate Remote Engine session. | | oriientEnv | Which env to work against. Taken from Envs enum. OnDevice with pre-saved data only | | simulateEventTags | Whether to simulate event tags during the session. Only in OnDevice mode. Default false. | | eventTagsSimulationInterval | The interval to send event tags. Only in OnDevice mode and if simulateEventTags is true. Default 1000 ms. | | useJwtAuth | Whether to use JWT authentication to communicate with the services. Default is false and it will use api key authentication. | | ipsAddress | Address of real time server to emulate against. Needed only if simulateOnDevice is false. Env var: IPS_ADDRESS. Default: ws://ipspp.oriient.me | | mongoUri | URI for the mongodb access. Needed only if originalSessionId is supplied. Otherwise will work with sample session. Env var: MONGO_URI. No Default. | | username | Username to send to the server. Default: RealTimeSessionEmulator | | newSessionId | If you want to control the uuid the session will get, you can pass it here. | | recordsBucket | The bucket name where the session records exist. Env var: RECORDS_BUCKET. No default. Needed only in Remote Engine emulation | | originalSessionId | The sessionId to emulate against the server. Needed only in OnDevice without pre-saved data. In Remote Engine it is a must | | msgTimeout | The timeout for a message to get response from the RTS. Only for Remote Engine emulation. Env var: MSG_TIMEOUT. Default: 30000 ms |

async runFullSession()

Convenient function to run a full session.

async prepareSessionData()

Prepare the session data. If not using sample data, downloads the relevant data.

Emit event: 'session-data-ready'

async login()

Perform login operations. In Remote Engine does nothing.

Emit event: 'LOGIN_SUCCESS'

async startPositioning()

Performs positioning operations

Emit event: 'START_POSITIONING_SUCCESS'

async startStreamingSessionData()

Start sending data to the server (either uploads chunks / streaming sensor data)

In all modes emit events:

  • 'SESSION_DATA_STREAM_END' when streaming of the data is over

In OnDevice mode emit events:

  • 'CHUNKS_UPLOAD' with data that included an object: { type, data, timeMs }. Type can be 'START_CHUNK' / 'CHUNK_UPLOADED' / 'END_CHUNK'. data will include the data returned from the operation and timeMs will include the time it took to upload.

In Remote Engine mode emit events:

  • 'position-update' for each position update
  • 'frame-sent' for each frame being sent

async stopPositioning()

Stops the positioning. In OnDevice does nothing.

Emit event: 'STOP_POSITIONING_SUCCESS'

stopStreamingSessionData()

Stops the streaming of the session data. Does not stop the session. Not relevant in OnDevice.

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