Websocket transport extension for matter in motion framework
Transport installation instructions
Websockets from the browser:
const msg = [ <request>, <data object>, <head object>, <requestId> ];
const con = new WebSocket('ws://localhost:3000/api');
con.onmessage = function(e) {
const res = JSON.parse(e.data);
console.log(res);
}
con.onopen = function() {
con.send(JSON.stringify(msg));
};
- pingInterval — number. Ping interval in milliseconds
- type string, 'application/json'. Default type of data, 'application/json' is onlt available option for now.
- port number, if defined creates its own http server and listens
port
, otherwise tries to use http transport server - serializer — string, serializer name to be used as default for websockets messages instead of default
License: MIT.