Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rsocket-tcp-server

Package Overview
Dependencies
Maintainers
5
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rsocket-tcp-server - npm Package Compare versions

Comparing version 0.0.28 to 0.0.29-alpha.0

build/index.js.flow

14

build/index.js

@@ -15,10 +15,14 @@ /** Copyright (c) Facebook, Inc. and its affiliates.

*
* @flow
*
*/
'use strict';
Object.defineProperty(exports, '__esModule', {value: true});
exports.default = void 0;
import RSocketTCPServer from './RSocketTCPServer';
export default RSocketTCPServer;
export type {ServerOptions} from './RSocketTCPServer';
var _RSocketTCPServer = _interopRequireDefault(require('./RSocketTCPServer'));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
var _default = _RSocketTCPServer.default;
exports.default = _default;

@@ -15,31 +15,24 @@ /** Copyright (c) Facebook, Inc. and its affiliates.

*
* @flow
*
*/
'use strict';
Object.defineProperty(exports, '__esModule', {value: true});
exports.default = void 0;
import type {DuplexConnection} from 'rsocket-types';
import type {Encoders, TransportServer} from 'rsocket-core';
import {RSocketTcpConnection} from 'rsocket-tcp-client';
var _rsocketTcpClient = require('rsocket-tcp-client');
import EventEmitter from 'events';
import net from 'net';
import {Flowable} from 'rsocket-flowable';
var _events = _interopRequireDefault(require('events'));
var _net = _interopRequireDefault(require('net'));
var _rsocketFlowable = require('rsocket-flowable');
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
export type ServerOptions = {|
host?: string,
port: number,
serverFactory?: (onConnect: (socket: net.Socket) => void) => net.Server,
|};
/**
* A TCP transport server.
*/
export default class RSocketTCPServer implements TransportServer {
_emitter: EventEmitter;
_encoders: ?Encoders<*>;
_options: ServerOptions;
constructor(options: ServerOptions, encoders?: ?Encoders<*>) {
this._emitter = new EventEmitter();
class RSocketTCPServer {
constructor(options, encoders) {
this._emitter = new _events.default();
this._encoders = encoders;

@@ -49,5 +42,5 @@ this._options = options;

start(): Flowable<DuplexConnection> {
return new Flowable(subscriber => {
let server: ?net.Server;
start() {
return new _rsocketFlowable.Flowable((subscriber) => {
let server;
const onClose = () => {

@@ -59,5 +52,7 @@ if (server) {

};
const onError = error => subscriber.onError(error);
const onConnection = (socket: net.Socket) => {
subscriber.onNext(new RSocketTcpConnection(socket, this._encoders));
const onError = (error) => subscriber.onError(error);
const onConnection = (socket) => {
subscriber.onNext(
new _rsocketTcpClient.RSocketTcpConnection(socket, this._encoders)
);
};

@@ -75,5 +70,6 @@ subscriber.onSubscribe({

},
request: n => {
request: (n) => {
if (!server) {
const factory = this._options.serverFactory || net.createServer;
const factory =
this._options.serverFactory || _net.default.createServer;
server = factory(onConnection);

@@ -89,5 +85,6 @@ server.listen(this._options.port, this._options.host);

stop(): void {
stop() {
this._emitter.emit('close');
}
}
exports.default = RSocketTCPServer;
{
"name": "rsocket-tcp-server",
"description": "RSocket TCP server",
"version": "0.0.28",
"version": "0.0.29-alpha.0",
"repository": {

@@ -12,8 +12,8 @@ "type": "git",

"dependencies": {
"rsocket-core": "^0.0.28",
"rsocket-flowable": "^0.0.28",
"rsocket-tcp-client": "^0.0.28",
"rsocket-types": "^0.0.28"
"rsocket-core": "^0.0.29-alpha.0",
"rsocket-flowable": "^0.0.29-alpha.0",
"rsocket-tcp-client": "^0.0.29-alpha.0",
"rsocket-types": "^0.0.29-alpha.0"
},
"gitHead": "1dd3eb28183991d663392d87877225bf862946e2"
"gitHead": "1b149fbd3dd66fbfdbaa91a8c95264214114c546"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc