WebSocket client (Implemented via winhttp)

Post your working scripts, libraries and tools.
User avatar
thqby
Posts: 433
Joined: 16 Apr 2021, 11:18
Contact:

Re: WebSocket client (Implemented via winhttp)

05 Nov 2023, 20:51

Because the current maximum number of threads for onmessage is 1, resulting in subsequent messages being ignored, I will adjust the synchronization function to fix this problem.
User avatar
thqby
Posts: 433
Joined: 16 Apr 2021, 11:18
Contact:

Re: WebSocket client (Implemented via winhttp)

06 Nov 2023, 00:21

@bonobo
This issue has been fixed in the latest version.
bonobo
Posts: 78
Joined: 03 Sep 2023, 20:13

Re: WebSocket client (Implemented via winhttp)

06 Nov 2023, 02:50

Wow, this is awesome, thanks thqby! I've just tested with a 1M json and it went over (from node to JS)!

On the other hand, this could be due to problems with my setup, but with the latest version of Websocket.ahk, sometimes the json message received is immediately followed by a second duplicate message, except truncated in the middle so it's no longer valid json. Again, I need to do more testing about this, but currently my incoming message log looks like this.

Code: Select all

====== 99399312 (normal json) ======
{"__id__":1,"__content__":{"wkc":"Open-source software","wks":"Software licensed to ensure source code usage rights","wkz":"277663","wzl":81590,"zwdz":"Q1130645","zwdi":[]}}

====== 99407750 (invalid json) ======
{"__id__":1,"__content__":{"wkc":"Open-source software","wks":"Sof 



====== 99408031 (normal json) ======
{"__id__":2,"__content__":{"wkc":"Free and open-source software","wks":"Software whose source code is available and which is permissively licensed","wkz":"1721496","wzl":83226,"zwdz":"Q506883","zwdi":[]}}

====== 99409671 (invalid json) ======
{"__id__":2,"__content__":{"wkc":"Free and open-sou



====== 99409843 (normal json) ======
{"__id__":3,"__content__":{"wkc":"Apache License","wks":"Free software license developed by the ASF","wkz":"145908","wzl":11622,"zwdz":"Q616526","zwdi":[["Q95107111","license scheme"],["Q207621","software license"]]}}

====== 99412859 (invalid json) ======
{"__id__":3,"__content__":{"wkc":"Apache L



====== 99413046 (normal json) ======
{"__id__":4,"__content__":{"wkc":"SPARC","wks":"RISC instruction set architecture","wkz":"36954","wzl":75277,"zwdz":"Q273190","zwdi":[["Q241317","computing platform"],["Q272683","instruction set architecture"]]}}

====== 99415593 (invalid json) ======
{"__id__":4,"__content__":{"wkc":"SPARC","wks":"RISC instructio

I also occasionally receive utf-8 messages that read 'P�' which seems like it may be the websocket overhead?

Code: Select all

====== 99285078(invalid json) ======
P

====== 99398921 (invalid json) ======
P� 
User avatar
thqby
Posts: 433
Joined: 16 Apr 2021, 11:18
Contact:

Re: WebSocket client (Implemented via winhttp)

07 Nov 2023, 03:30

bonobo wrote: I also occasionally receive utf-8 messages that read 'P�' which seems like it may be the websocket overhead?
In asynchronous mode, both send and receive trigger callbacks, and the received data is damaged due to improper processing.
This has been fixed.
bonobo
Posts: 78
Joined: 03 Sep 2023, 20:13

Re: WebSocket client (Implemented via winhttp)

07 Nov 2023, 16:21

This is awesome! 👍

I'm using it to take advantage of some JS features, like variable width lookbehind.

I'm amazed how fast this is. I just tested sending a 8M JSON string to node, process it there using some regex , then send back the results (roughly 8.2M) and it all finished within 100ms.

Return to “Scripts and Functions (v2)”

Who is online

Users browsing this forum: No registered users and 53 guests