imt-gateway1.0.3 • Public • Published
Integromat Gateway Client for Node.js
$ npm install imt-gateway
const Client Event = ;let gw =key: '-----BEGIN RSA PRIVATE KEY----- ...'cert: '-----BEGIN CERTIFICATE----- ...'gwgwgw;
Obtaining a Certificate
Client is an EventEmitter.
let gw = options;
key- Private key in PEM format. Required.
cert- Signed certificate in PEM format. Required.
autoReconnect- Auto reconnect. Optional, default:
maxReconnectAttempts- Max number of reconnect attempts. If the connection was successfuly established before the disconnect happened,
disconnectevent will be emitted after consuming all reconnect attempts. If the connection was not connected,
errorevent with error message will be emitted. Unlimited by default.
connect- Dispatched after connection has established.
disconnect- Dispatched after connection has closed.
drain- Dispatched after all actions from the server was received. Client must not send events before
action(action, ack)- Dispatched when new action is received from the server.
error(err)- Dispatched on error.
Create a new connection to the server.
Close connection to the server.
Send new event to the server. Message is automatically queued when connection is not yet established or when another event was not yet processed.
event- Instance of an Event object.
callback(err)- A callback which is called after the event was successfuly received by the server, or if an error has occurred.
let event = 'weather'temperature: 24;gw;
Events are messages sent from client to the server.
let event = type data;
IMPORTANT: Client muset always wait for
drain event before it can send events to the server.
type- Type of an event.
data- An object containing data to be transfered to the server.
Actions are messages sent from the server to client.
IMPORTANT: Server always wait for the acknowledgement before it sends another action to the client.
Copyright (c) 2016 Integromat
The MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.