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.27 to 0.0.28

14

build/index.js

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

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

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

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

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

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

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

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

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

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

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

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

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

"dependencies": {
"rsocket-core": "^0.0.27",
"rsocket-flowable": "^0.0.27",
"rsocket-tcp-client": "^0.0.27",
"rsocket-types": "^0.0.27"
"rsocket-core": "^0.0.28",
"rsocket-flowable": "^0.0.28",
"rsocket-tcp-client": "^0.0.28",
"rsocket-types": "^0.0.28"
},
"gitHead": "23da9b0e9377ba52d3294cf4763cbbf3de7ba7b1"
"gitHead": "1dd3eb28183991d663392d87877225bf862946e2"
}

@@ -0,0 +0,0 @@ # rsocket-tcp-server

Sorry, the diff of this file is not supported yet

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