0.2.10-snapshot.feature-gateway-client-package.1620839036 • Published 5 years ago

@scalecube/rsocket-ws-gateway v0.2.10-snapshot.feature-gateway-client-package.1620839036

Weekly downloads
298
License
MIT
Repository
-
Last release
5 years ago

Join the chat at https://gitter.im/scalecube-js/Lobby

This is part of scalecube-js project, see more at https://github.com/scalecube/scalecube-js
Full documentation

rsocket-websocket-gateway

This package provides gateway implementation for NodeJS based on rsocket websocket

API

interface Gateway {
  constructor(options: {port: number, requestResponse?: RequestHandler, requestStream?: RequestHandler});
  start: (options: { serviceCall: ServiceCall }) => void;
  stop: () => void;
}

Usage

Server side

import { createMicroservice } from '@scalecube/scalecube-microservice';
import { Gateway } from '@scalecube/rsocket-ws-gateway';

const definition = {
  serviceName: 'serviceA',
  methods: {
    methodA: { asyncModel: ASYNC_MODEL_TYPES.REQUEST_RESPONSE },
  },
};
const reference = { methodA: () => Promise.resolve('ok') };
const services = [{ definition, reference }];
const ms = createMicroservice({ services });
const serviceCall = ms.createServiceCall({});
const gateway = new Gateway({ port: 3000 });
gateway.start({ serviceCall });

Client side

import { createGatewayProxy } from '@scalecube/rsocket-ws-gateway/dist/createGatewayProxy';


const definition = {
  serviceName: 'serviceA',
  methods: {
    methodA: { asyncModel: ASYNC_MODEL_TYPES.REQUEST_RESPONSE },
  },
};
  const proxy = await createGatewayProxy('ws://localhost:3000', definition);
  const resp = await proxy.methodA() // => 'ok'
0.2.11

5 years ago

0.2.9

6 years ago

0.2.8

6 years ago

0.2.7

6 years ago

0.2.2-test.0

6 years ago

0.2.3-test.0

6 years ago

0.2.0

6 years ago

0.0.3-next.21

6 years ago

0.0.3-next.20

6 years ago

0.0.3-next.19

6 years ago

0.0.3-next.18

6 years ago

0.0.3-next.17

6 years ago

0.0.3-next.16

6 years ago

0.0.3-next.15

6 years ago

0.0.3-next.14

6 years ago

0.0.3-next.13

6 years ago

0.0.3-next.12

6 years ago

0.0.3-next.11

6 years ago

0.0.3-next.10

6 years ago

0.0.3-next.9

6 years ago

0.0.3-next.8

6 years ago

0.0.3-next.7

6 years ago

0.0.3-next.6

6 years ago

0.0.3-next.5

6 years ago

0.0.3-next.4

6 years ago

0.0.3-next.3

6 years ago

0.0.3-next.2

6 years ago

0.0.3-next.1

6 years ago

0.0.3-next.0

6 years ago

0.0.2-next.2

6 years ago

0.0.2-next.1

6 years ago

0.0.2-next.0

6 years ago

0.0.2-alpha.9

6 years ago

0.0.2-alpha.8

7 years ago

0.0.2-alpha.7

7 years ago

0.0.2-alpha.6

7 years ago

0.0.2-alpha.5

7 years ago

0.0.2-alpha.4

7 years ago

0.0.2-alpha.3

7 years ago

0.0.2-alpha.2

7 years ago

0.0.2-alpha.1

7 years ago

0.0.2-alpha.0

7 years ago

0.0.1

7 years ago