RoTerentev / metacom

RPC communication protocol for Metarhia stack πŸ”Œ

Home Page:https://metarhia.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Metacom Communication Protocol for Metarhia

ci status codacy snyk npm version npm downloads/month npm downloads

Metacom protocol specification: https://github.com/metarhia/Contracts/blob/master/doc/Metacom.md

// Load at frontend
import { Metacom } from './metacom.js';

// Load at backend
const { Metacom } = require('metacom');

// Open connection (both platforms) and make calls
const metacom = new Metacom('https://domainname.com:8000');
(async () => {
  try {
    await metacom.load('auth'); // Load `auth` interface
    await api.auth.status(); // Check session status
  } catch (err) {
    await api.auth.signIn({ login: 'marcus', password: 'marcus' });
  }
  await metacom.load('example'); // Load `example` interface
  const result = api.example.methodName({ arg1, arg2 });
})();

About

RPC communication protocol for Metarhia stack πŸ”Œ

https://metarhia.com

License:MIT License


Languages

Language:JavaScript 100.0%