Tectu / malloy

A cross-platform C++20 library providing embeddable server & client components for HTTP and WebSocket.
BSD 3-Clause "New" or "Revised" License
68 stars 8 forks source link

Add TLS support for websockets #36

Closed Tectu closed 3 years ago

Tectu commented 3 years ago

Currently, we have implemented TLS support for HTTP client & server. However, WebSocket support is currently plain only.

@0x00002a did you by any chance already start working on this when you restructured the websocket connections?

0x00002a commented 3 years ago

I didn't start working on it exactly, although I can have a go at doing this (I've never done TLS websockets before so might take a bit :p), but I did implement it with TLS in mind (thats why stream exsits, to wrap a possible TLS version of it)

0x00002a commented 3 years ago

@Tectu I think quite a clean way to do this (for the client) would be letting the user pass in a uri which was parsed for either ws:// or wss:// but since the API already has http/https versions do you think it would be better to have a make_secure_websocket_connection instead? Also make_websocket_connection is quite a mouthful, I'm not sure if it can really be shortend without losing clarity but make_secure_websocket_connection is too long imo. ws_connect and wss_connect could work?

Edit I'm leaning more toward ws/wss_connection now that I'm thinking about it. We could always add a wrapper function that parses the uri and calls those for convience (or users can easily write on with their preferred parsing method)