@everymatrix/om-connector
TypeScript icon, indicating that this package has built-in type declarations

0.0.14 • Public • Published

Usage of the feed

To connect to our server, using the PUSH type connection (with any programming language), you need to follow the steps:

  1. Open a TCP socket to our server.
  2. Write a subscribe-request SDQL
  3. Read from the socket. You will receive a subscribe-response SDQL, followed by initial-data SQL and you will keep receiving update-data SDQL until you send an unsubscribe-request SDQL or the socket closes.
  4. Respond to ping-request SDQL. (write a ping-response SDQL with the id from the ping-request)

How to write over the socket in the correct format:

  1. Compute the message (the SDQL construct). You can find all the SDQLs in the documentation received from EveryMatrix:
    Ex: subscribe request:
<?xml version="1.0" encoding="UTF-8"?>
<sdql>
<SubscribeRequest subscriptionSpecificationName="SubscriptionName"/>
</sdql>
  1. Compress the message using the GZIP algorithm.
  2. Calculate the length of the GZIPPED message.
  3. Convert the number from 3 to a string (Ex: from 123 to “123”)
  4. Write on the socket the length (the string obtained at 4)
  5. Write on the socket a zero byte (a byte whose value is 0)
  6. Write the gzipped message

How to read and interpret the messages coming from the socket, after you just opened the socket:

  1. Read bytes until you find a zero byte.
  2. Convert the read bytes to a string.
  3. Convert the String from 2 to a number (Integer), let’s call it N
  4. Read exactly N bytes (the number from 3) from the socket.
  5. Decompress the message from 4 using GZIP algorithm
  6. Convert the result from 5 to a string You have the message.

Changelog

0.0.14

  1. implemented startWithResume functionality

0.0.13

  1. Fix package.json "main" property
  2. Add .eslintrc.json file in examples

0.0.10

  1. Fix file dependencies paths

0.0.9

  1. Added build for example_ts; refactor examples
  2. Refactor tests

0.0.8

0.0.7

  1. Changed language to TypeScript
  2. Changed data structuring to JSON from XML
  3. Added example files for both JavaScript and TypeScript

0.0.6

  1. Add reconnect w/ resume-updates mechanism if the socket has been down for any reason.

0.0.5

  1. Add section 'Versions' to README.md

0.0.4

  1. Retry mechanism. If the client gets disconnected, the connector keeps trying to resubscribe to the server.
  2. Modify the xml-to-json parser to transform all numbers into strings.

Readme

Keywords

none

Package Sidebar

Install

npm i @everymatrix/om-connector

Weekly Downloads

20

Version

0.0.14

License

none

Unpacked Size

160 kB

Total Files

92

Last publish

Collaborators

  • stefanao
  • maria.bumbar
  • emfe_release
  • radu.besliu.em
  • taras.maksymiv
  • oleksandr.v.stepanov
  • andriizadvirnyi
  • mariana.gheorghe
  • dragos.bodea
  • stefan.vlad
  • strulea.sebastian
  • raulvasileem
  • adrian.pripon
  • natalya.anisimova
  • clokze