0.4.0 • Published 3 years ago

@zwfthcks/zwift-packet-monitor v0.4.0

Weekly downloads
9
License
ISC
Repository
github
Last release
3 years ago

zwift-packet-monitor

This module monitors Zwift UDP traffic on port 3022 and TCP traffic on port 3023 (both contains protobuf payloads) and emits events for

  • player state updates (incomingPlayerState and outgoingPlayerState)
  • ride ons (incomingPlayerGaveRideOn)
  • chat messages (incomingPlayerSentMessage)
  • player entered world (incomingPlayerEnteredWorld)

Install

Prerequisites

On Windows this requires Npcap installed with WinPcap API compatibility. On other systems, libpcap should be installed.

Installation

The fork by jeroni is published as @zwfthcks/zwift-packet-monitor on NPM.

npm install @zwfthcks/zwift-packet-monitor

Alternatively, install with npm from GitHub

npm install https://github.com/jeroni7100/zwift-packet-monitor

or download/clone from GitHub and install directly from your local copy, for example like this if the copy resides in a sibling folder to your project:

npm install ../zwift-packet-monitor

The original version by wiedmann can be installed from NPM:

npm install zwift-packet-monitor

Usage

(Assumes installation from NPM)

const ZwiftPacketMonitor = require('@zwfthcks/zwift-packet-monitor')

// interface is cap interface name (can be device name or IP address)
const monitor = new ZwiftPacketMonitor(interface)

monitor.on('outgoingPlayerState', (playerState, serverWorldTime) => {
  console.log(playerState)
})

monitor.on('incomingPlayerState', (playerState, serverWorldTime) => {
  console.log(playerState)
})

// The Zwift server sends states in batches. This event is emitted at the end of each incoming batch
monitor.on('endOfBatch', () => {
  console.log('end of batch')
})

monitor.start()

Relevant links

Npcap https://nmap.org/npcap/

Development tools

Uses preprocessor.js (https://www.npmjs.com/package/preprocessor) to build ZwiftPacketMonitor.js from ZwiftPacketMonitorDebug.js

npm i -g preprocessor
0.4.0

3 years ago

0.3.7

3 years ago

0.3.5

4 years ago

0.3.4

4 years ago

0.3.3

5 years ago

0.3.2

5 years ago