RSocketTCPClient - rsocket-js
The RSocketTCPClient implements the RScocket protocol using the TCP network transport protocol, and is suitable for Server to Server, and other scenarios where raw TCP is available.
note
RSocketTCPClient is not supported in web browser environments. For web browser environments, RSocketWebsocketClient is recommended and supported.
TCP Client Quick Start Example
note
This guide pertains to rsocket-js 0.x versions. Ensure that your version of rsocket- packages are not 1.0.0-alpha before following this guide.
npm install rsocket-core rsocket-tcp-client
import { RSocketClient } from 'rsocket-core';
import RSocketTCPClient from 'rsocket-tcp-client';
async function createClient(options) {
  const client = new RSocketClient({
    setup: {
      dataMimeType: 'text/plain',
      keepAlive: 1000000, // avoid sending during test
      lifetime: 100000,
      metadataMimeType: 'text/plain',
    },
    transport: new RSocketTCPClient({
      host: options.host,
      port: options.port,
    }),
  });
  return await client.connect();
}
async function run() {
  const rsocket = await createClient({
    host: '127.0.0.1',
    port: 9898,
  });
  ...
}
await run();