Skip to content

NSURLSessionWebSocket implementation - #775

Draft
HendrikHuebner wants to merge 13 commits into
gnustep:masterfrom
HendrikHuebner:websocket
Draft

NSURLSessionWebSocket implementation#775
HendrikHuebner wants to merge 13 commits into
gnustep:masterfrom
HendrikHuebner:websocket

Conversation

@HendrikHuebner

Copy link
Copy Markdown
Contributor

This is the full implementation for NSURLSessionWebSocket based on libcurl's callback based websocket API.

It does not handle all possible scenarios (For example HTTP redirects, cookies), but the basic functionality and Websocket connection protocol is implemented.

I ran a concurrent stress test with this setup, which spawns a dozen thread that hammer multiple WebSocket tasks with requests concurrently and verify some basic invariants (Such as the received / send count, pingpongs and the message sizes / content). The results matched the Apple implementation and the throughput is comparable.

I don't think it makes sense to upstream this setup as a unit test however. Unit testing this implementation is a bit difficult, since you need a client/server connection to do it (Even if just localhost) and testing nontrivial cases is hard.

@HendrikHuebner

Copy link
Copy Markdown
Contributor Author

@triplef I'm not sure we can merge it this week

@rfm

rfm commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

I realise this is just a draft at this point, but I'm a bit concerned about [Gate WebSocket API on Blocks support] (a882559)
We can't be doing that as GNUstep needs portable code: I'd suggest implementing and testing a non-blocks version first and once that's fully functional, add the blocks API methods needed for OSX compatibility, flagged as non-portable.

@rfm

rfm commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Unit testing this implementation is a bit difficult, since you need a client/server connection
to do it (Even if just localhost) and testing nontrivial cases is hard.
I know that libwebsockets comes with a test server and a load of testcases. Perhaps the github workflows could be modified to install/use that for testing (perhaps put it into the testsuite as code to be run only if libwebsockets is available)?

@hmelder

hmelder commented Sep 8, 2026

Copy link
Copy Markdown
Member

I'll continue working on the websocket implementation in https://github.com/gnustep/libs-base/tree/websockets

@HendrikHuebner

HendrikHuebner commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

@hmelder Sure. Please reset to a78f913. Everything after are unreviewed LLM attempts of fixing the GCC compatibility, I don't know if any of it is usable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants