1 of 6

W3C Gen2 payload compression

Ulf Bjorkengren, Sanjeev BA@Samsung

2 of 6

Compression overview

  • Low processing load through context aware algorithm using lookup tables.
  • Implemented and tested on https://github.com/UlfBj/W3C_VehicleSignalInterfaceImpl (compress branch). Plan to push to upstream master.
  • Achieved compression 3 - 5 times (version 1), 4,5 - 7 times (in coming version 2).
  • Current design/impl is invokable on Websocket only, but can be extended to HTTP.
  • Design pattern can be extended with implementations that invoke other compression algos, e. g. gzip, LZW.
  • To become a Gen2 Note, or in Best Practises?

© 2020 Geotab Inc. All Rights Reserved | 2

3 of 6

Compression design, version 1

  • It is activated on Websocket sessions by setting the subprotocol to “gen2cx”, where x = [1..32] which sets the number of (MSB) UUID bytes used to replace a path.
  • A message is divided up into “tokens”, where a token is everything in between two quotes, or common JSON characters ({, }, [, ], :, ,,).
  • Tokens being common JSON characters are not compressed.
  • Tokens in between quotes are compared with a predefined list, and if a match is found the list index for the matching element is added to 128, stored in a character and inserted in the compressed message as a replacement for the token.
  • Tokens being paths are compared to a list of all paths in the VSS tree, and if matching it is replaced by the number of MSB bytes in the UUID corresponding to that path that were signalled in the subprotocol.

  • Tokens being timestamp values are replaced by six bytes:
  • Byte1: The two least significant digits of the year (2020 is replaced by 20)
  • Byte2: The month [1..12]
  • Byte3: The day[1..31]
  • Byte4: The hour[0..23]
  • Byte5: The minute[0..59]
  • Byte6: The second[0..59]
  • Currently subseconds are not handled.

© 2020 Geotab Inc. All Rights Reserved | 3

4 of 6

Compression example

  • WebSocket init:
    • new WebSocket("ws://" + hostIP + ":8080", "gen2c4");
  • Request:
    • {"action":"get", "path":"Vehicle/ADAS/ABS?$pathEQ*", "requestId":"235"}

© 2020 Geotab Inc. All Rights Reserved | 4

5 of 6

Corporate headquarters

Geotab Inc.

2440 Winston Park Drive

Oakville, Ontario

L6H 7V2, Canada

Tel: +1.416.434.4309

geotab.com

Geotab Waterloo

137 Glasgow Street, �Unit 340

Kitchener, Ontario

N2G 4X8, Canada

USA

770 E. Pilot Rd, �Suite A�Las Vegas, Nevada �89119, USA

Mexico City

Paseo de la Reforma 296�Juárez, 06600,�Mexico City, �Mexico

France

Geotab GmbH

67 Avenue de Wagram

Paris, 75017

France

Germany

Geotab GmbH,

Kaiserstr. 100

52134 Herzogenrath,

Germany

Spain

Geotab GmbH

Calle de la Princesa, �43 2ºD, 28008 Madrid,

Spain

Italy

Geotab GmbH

Viale Citta d’Europa 39

00144, Rome,

Italy

Australia

Level 24 Westpac House,

91 King William Street

Adelaide SA 5000

Australia

China

Room 707, Mai Ke Long�Building, Science and�Technology Park, Nanshan�District, Shenzhen, Guangdong, China 518057

USA

7180 Pollock Drive, �Las Vegas, Nevada �89119, USA

UK

Geotab GmbH

3 Waterhouse Square

138 - 142 Holborn,

London, EC1N 2SW

United Kingdom

6 of 6

6

Let’s Stay Connected:�