Messaging with wss://
nmset opened this issue · 2 comments
nmset commented
While testing a req-rep minimal setup with wss://, no message is sent or received when using IPV6 addresses. With IPV4 ones, or with 'localhost', the client/server messaging is straightforward. Firewall is off on the host.
The attached file may demonstrate it.
I don't know if it's the right place to seek help resolving this. I'm posting here because I'm using nngpp, and not the C interface directly.
Regards.
cwzx commented
The flags you're passing to listen/dial are wrong. NNG_AF_INET etc are not flags.
- Flags for listen are ignored.
- Dial only supports NNG_FLAG_NONBLOCK. By passing NNG_AF_INET you're accidentally enabling async dialing which is why you can't see the connection error.
I found the following:
- TLS is not required and can be removed from the demo.
- Using ipv6 address works with
tcp://
but fails withws://
on thedial
with errorConnection refused
.
TEST_CASE("ws ipv6", "[ip]") {
auto addr = "ws://[::1]:8003";
nng::socket rep_socket = nng::rep::open();
REQUIRE_NOTHROW( rep_socket.listen( addr ) );
nng::socket req_socket = nng::req::open();
REQUIRE_NOTHROW( req_socket.dial( addr ) );
REQUIRE_NOTHROW( req_socket.send("hello") );
REQUIRE( rep_socket.recv() == "hello" );
REQUIRE_NOTHROW( rep_socket.send("world") );
REQUIRE( req_socket.recv() == "world" );
}
I don't know of a good reason for this behaviour. Definitely ask at nng.
nmset commented
Thank you very much for a detailed time-saving reply .
I'll just drop wss:// and use tls+tcp://.
Best regards.