0.2.10-develop.1627568201 • Published 5 years ago

@scalecube/rsocket-ws-gateway-client v0.2.10-develop.1627568201

Weekly downloads
-
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-client

Client for rsocket websocket gateway for browser and server usage

yarn add @scalecube/rsocket-ws-gateway-client or npm i @scalecube/rsocket-ws-gateway-client

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


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'

Available also as IFFE at JSDELIVER

<script src="https://cdn.jsdelivr.net/npm/@scalecube/rsocket-ws-gateway-client@latest/dist/index.js"></script>
<script>
    const definition = {
        serviceName: 'serviceA',
        methods: {
            methodA: { asyncModel: ASYNC_MODEL_TYPES.REQUEST_RESPONSE },
        },
    };
    
    const connection = sc.createGatewayProxy('ws://localhost:3000', definition);
    const resp = connection.then((proxy) => proxy.methodA()) // => 'ok' 
</script>