mm-websockets
v1.0.1
Published
Matter in motion websockets transport
Maintainers
Readme
Matter In Motion. Websockets transport
Websocket transport extension for matter in motion framework
Usage
Transport installation instructions
Protocol
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));
};Settings
- 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.
