RSocketWebSocketServer - 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-websocket-server rsocket-flowable
const { RSocketServer } = require('rsocket-core');
const RSocketWebSocketServer = require('rsocket-websocket-server');
const { Single } = require('rsocket-flowable');
const WebSocketTransport = RSocketWebSocketServer.default;
const host = '127.0.0.1';
const port = 3000;
const transportOpts = {
host: host,
port: port,
};
const transport = new WebSocketTransport(transportOpts);
const rSocketServer = new RSocketServer({
transport,
getRequestHandler: function () {
...
},
});
rSocketServer.start();