@everymatrix/om-connector
v0.0.14
Published
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 SD
Downloads
62
Maintainers
Keywords
Readme
Usage of the feed
To connect to our server, using the PUSH type connection (with any programming language), you need to follow the steps:
- Open a TCP socket to our server.
- Write a subscribe-request SDQL
- 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.
- 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:
- 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>
- Compress the message using the GZIP algorithm.
- Calculate the length of the GZIPPED message.
- Convert the number from 3 to a string (Ex: from 123 to “123”)
- Write on the socket the length (the string obtained at 4)
- Write on the socket a zero byte (a byte whose value is 0)
- Write the gzipped message
How to read and interpret the messages coming from the socket, after you just opened the socket:
- Read bytes until you find a zero byte.
- Convert the read bytes to a string.
- Convert the String from 2 to a number (Integer), let’s call it N
- Read exactly N bytes (the number from 3) from the socket.
- Decompress the message from 4 using GZIP algorithm
- Convert the result from 5 to a string You have the message.
Changelog
0.0.14
- implemented
startWithResume
functionality
0.0.13
- Fix package.json "main" property
- Add .eslintrc.json file in examples
0.0.10
- Fix file dependencies paths
0.0.9
- Added build for example_ts; refactor examples
- Refactor tests
0.0.8
0.0.7
- Changed language to TypeScript
- Changed data structuring to JSON from XML
- Added example files for both JavaScript and TypeScript
0.0.6
- Add reconnect w/ resume-updates mechanism if the socket has been down for any reason.
0.0.5
- Add section 'Versions' to README.md
0.0.4
- Retry mechanism. If the client gets disconnected, the connector keeps trying to resubscribe to the server.
- Modify the xml-to-json parser to transform all numbers into strings.