airsdk / Adobe-Runtime-Support

Report, track and discuss issues in Adobe AIR. Monitored by Adobe - and HARMAN - and maintained by the AIR community.
206 stars 11 forks source link

No solution for client websocket desktop air app, please help! #3274

Open JoseEstevesPt opened 6 months ago

JoseEstevesPt commented 6 months ago

I'm using Adobe Animate 24.0.3 and Air SDK 50.2.4.4, creating a desktop app that connects do websockets (websockt or websocket IO) server, I've tried all the old libraries, help of chat GPT, help of Copilot, nothing works. Then I saw this post...How can I get AIR SDK 51? will I be able to solve my problem. Please help!

Discussed in https://github.com/airsdk/Adobe-Runtime-Support/discussions/3081

Originally posted by **ajwfrost** February 23, 2024 Hi all. Finally, we are releasing a new major version of the AIR SDK - the major version update is because of a number of new ActionScript APIs and features that are being added, which means the SWF version code will also be going up to 51 (fourth byte of the SWF = 0x33). This discussion thread is to provide information about the new features/APIs. Our intention is to create a new main comment for each of the features, and then we (or anyone) can reply on those comment threads, so that we keep each thread specifically about a particular feature. We can then use it to give examples, provide updates on the status (51.0 is released initially as a beta/pre-release, some features are not actually completed), and hopefully it still stay roughly organised. For full ActionScript API details, check out the "What's New" page of https://airsdk.dev/reference/actionscript/3.0/
bobaoapae commented 5 months ago

manually editing catalog.xml and all plataform xml to use 50.2 instead of 51.0 fixed the error of invalid ane.

bobaoapae commented 5 months ago

AndroidWebSocket.zip

bobaoapae commented 5 months ago

Connection to websocket works using this ANE, but my websocket server it's not receiving any data after i call _webSocket.sendMessage(WebSocket.fmtBINARY, sendBytes);

bobaoapae commented 5 months ago
06-28 11:08:26.967  3013  4505 D AndroidSocketThread: Callback: onSendingHandshake
06-28 11:08:27.510  3013  4505 D AndroidSocketThread: Callback: onStateChanged
06-28 11:08:27.511  3013  4505 D AndroidSocketThread: Callback: onThreadCreated
06-28 11:08:27.512  3013  4505 D AndroidSocketThread: Callback: onThreadCreated
06-28 11:08:27.512  3013  4505 D AndroidSocketThread: Callback: onThreadStopping
06-28 11:08:27.513  3013  4523 D AndroidSocketThread: Callback: onThreadStarted
06-28 11:08:27.513  3013  4523 D AndroidSocketThread: Callback: onConnected
06-28 11:08:27.513  3013  4524 D AndroidSocketThread: Callback: onThreadStarted
06-28 11:08:27.522  3013  3013 D AndroidWebSocketSendMessage: Called sendMessage
06-28 11:08:27.522  3013  3013 D AndroidWebSocketSendMessage: Message is a byte array
06-28 11:08:27.522  3013  3013 E AndroidSocketThread: Eror sending bytes: null
ajwfrost commented 5 months ago

manually editing catalog.xml and all plataform xml to use 50.2 instead of 51.0 fixed the error of invalid ane.

WebSocket is a class introduced in AIR 51.0 so I'm a little surprised it works if you drop that down.

Although ... ah, I've just realised, we had a bug in how the platform descriptor files derived from earlier ones, which may have caused this. The fix is already in our internal builds, about to be released, so I wouldn't have seen that issue....


E AndroidSocketThread: Eror sending bytes: null

We'll have to check on this one.. are you able to confirm that you sent in a byte array (and presumably it wasn't null or empty)?

thanks

bobaoapae commented 5 months ago

manually editing catalog.xml and all plataform xml to use 50.2 instead of 51.0 fixed the error of invalid ane.

WebSocket is a class introduced in AIR 51.0 so I'm a little surprised it works if you drop that down.

Although ... ah, I've just realised, we had a bug in how the platform descriptor files derived from earlier ones, which may have caused this. The fix is already in our internal builds, about to be released, so I wouldn't have seen that issue....

E AndroidSocketThread: Eror sending bytes: null

We'll have to check on this one.. are you able to confirm that you sent in a byte array (and presumably it wasn't null or empty)?

thanks

Yeah.. sending byteArray.

private function sendConfirmConnection():void
    {
        var sendBytes:ByteArray =new ByteArray();
        sendBytes.writeUTF(RandomUtils.UIDv4());
        sendBytes.writeUTF("confirm-connection");
        sendBytes.writeInt(_areaId);
        sendBytes.writeUTF("token");
        sendBytes.writeBoolean(_wsConnectionId != null);
        if (_wsConnectionId != null)
        {
            sendBytes.writeUTF(_wsConnectionId);
        }
        _webSocket.sendMessage(WebSocket.fmtBINARY, sendBytes);
    }
bobaoapae commented 5 months ago

My implementation it's working normally for windows, i just made a change to use AndroidWebSocket instead of WebSocket..

ajwfrost commented 5 months ago

Hi

You can try this one, it fixes an issue with sending and receieving ByteArray data..

AndroidWebSocket_ane_v3.zip

thanks