Problems with socket on cpp target for Mac and RPi [resolved]

Hey guys I have seen several topics on Sockets but a solution to my problem wasn’t in them.

I’m trying to connect an openfl demo (cpp target) to an existing nodejs app that uses Websockets.
I tried using several websocket libraries, [for instance soywiz websocket ] (https://github.com/soywiz/openfl-websocket) and [yar3333-haxe-websocket] (https://bitbucket.org/yar3333/haxe-websocket), that were built for older openfl versions and haxe, but none of them seem to work on my mac or rpi with cpp as a target with openfl 3.6.0 (not even the supplied example) .

I made a simple nodejs websocket server that uses the ws library.
A standard websocket from a browser works just fine but when I connect from my app the socket is immediately closed after the handshake.
It looks like the server is receiving a null-byte character after each socket.write and/or socket.flush
( nodejs output is <Bufferr 0x0 0x0> )
The ws library treats this byte as ‘out of sync’ and closes the connection.

I can trick my own demo by customizing the ws library to ignore this null byte after the handshake.
But the when I send a text or binary message it will receive it and also receive the null byte again and close the socket.
Of course I can’t make the modification the the existing nodejs app.

I can’t find where this byte is coming from.
I’m sure I’m not sending it and I can’t find it in OpenFL’s socket or settings for haxe.sys.net.Socket

Any thoughts anyone?

If I can get the websocket to work I would like to continue with modifying the openfl-socket.io extension out there that’s now only working with an older version 0.9 of socket.io

I think I have yar3333-haxe-websocket working now (it was missing the websocket protocol version in the handshake string)
This library is not sending the extra null byte… So I guess I’ll start comparing the 2 libs for differences.

Ow Wonderful!

Soywiz updated his libraries haxe-ws and openfl-websocket.
Seems to be working now.

:slightly_smiling: