rsocket / rsocket-js

JavaScript implementation of RSocket
https://github.com/rsocket/rsocket-js
Apache License 2.0
594 stars 97 forks source link

examples: ensure the server port matches the client port #232

Closed SerCeMan closed 2 years ago

SerCeMan commented 2 years ago

Unless I misunderstood the intent, the server port doesn't seem to match the client port defined below.

https://github.com/rsocket/rsocket-js/blob/7b1fe16e50d41935480e0b3e1beb381e8b07c41f/packages/rsocket-examples/src/ClientServerRequestChannelResumeExample.ts#L100

The port mismatch causes the example to fail with the following error.

(node:20091) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 127.0.0.1:8001
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1144:16)
(node:20091) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:20091) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Changing the server port to 8001 fixes the example.

OlegDokuka commented 2 years ago

That is intentionally. This example suppose to use a tool called socat https://github.com/rsocket/rsocket-java/blob/master/rsocket-examples/src/main/java/io/rsocket/examples/transport/tcp/resume/readme.md

SerCeMan commented 2 years ago

Ah, this makes sense, I missed it. 👍