Support RSocket
Skip to main content

RSocketTCPServer - rsocket-js

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-server rsocket-flowable
const { RSocketServer } = require('rsocket-core');
const RSocketTCPServer = require('rsocket-tcp-server');
const { Single } = require('rsocket-flowable');

const TCPTransport = RSocketTCPServer.default;

const host = '127.0.0.1';
const port = 3000;

const transportOpts = {
host: host,
port: port,
};

const transport = new TCPTransport(transportOpts);

const rSocketServer = new RSocketServer({
transport,
getRequestHandler: function () {
...
},
});

rSocketServer.start();