WebSocket client misses messages sent right after connection
Nobody has claimed this yet.
- Dominant language
- Ada
- Stars
- 162
- Forks
- 45
- PR merge metrics
- No merged PRs in 30d
Description
It seems that AWS's WebSocket client API misses messages that get sent immediately after connection roughly 8 out of 10 times.
I've tested this by opening a connection to wss://echo.websocket.org and waiting for a message, which sometimes comes and sometimes doesn't. Testing with an online WebSocket tester tool gets the message every time.
The code for the main program above is as follows:
with Ada.Text_IO; use Ada.Text_IO;
with AWS;
with AWS.Net.WebSocket;
with AWS.Net.SSL;
procedure Main is
type MySocket is new AWS.Net.WebSocket.Object with null record;
overriding procedure On_Message(Self : in out MySocket; Str : String) is
begin
Ada.Text_IO.Put_Line ("++ Got message '" & Str & "'");
end On_Message;
Socket : MySocket;
begin
AWS.Net.SSL.Initialize_Default_Config(Security_Mode => AWS.Net.SSL.TLS_Client, Client_Certificate => "", Check_Certificate => True);
AWS.Net.WebSocket.Connect(Socket,"wss://echo.websocket.org");
while Socket.Poll(Timeout => 2.0) loop
null;
end loop;
Socket.Close("");
end Main;
For reference, here's what an online WebSocket test tool shows after connecting and disconnecting a few times:
Unfortunately, some APIs (e.g. Discord's Gateway API) rely on the server sending a message immediately after connecting, preventing these APIs from being used with AWS.
Also, in case it matters, I tested this from a freshly-built AWS from the master branch with SOCKET=openssl, on Debian Testing running under WSL2 (so kernel 5.15.167.4-microsoft-standard-WSL2).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the problem with the provided Main program, focusing on AWS.Net.WebSocket.Connect and the Poll loop. Compare runs against wss://echo.websocket.org and verify whether messages sent immediately after connection are consistently delivered. Done means the client receives those early server messages reliably, including APIs that send data immediately after connecting.
Written by the indexing model from the issue text.
Assessment
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100