elixir-socket
elixir-socket copied to clipboard
Some advanced SSL options to web connection functions
Hi,
I need to pass some advanced SSL options (like cert, key, etc) to the websocket module connection functions but it seems to be currently not possible.
So I just patched the Socket.Web module to transmit a new optional "ssl_options" (via the connect! function) down to the Socket.SSL module and it seems to work but it's a bit quick'n'dirty for now and before going further and propose a PR, I would like to know if I'm on a good track or if it's something that would interest somebody else than me?
It would make sense to just remove the websocket specific options, then pass the given options over to the underlying socket type.
I'm working on this myself now because option handling is kind of complicated.
@Guid75 can you try on master? Just pass the SSL/TCP options along with the other (if any) websocket options.
Sorry for the late answer.
I just read the master version of web.ex but I think it will be hard to handle options name conflict. For instance, key is used as a websocket option and as a SSL layer options as well. Maybe a more explicit strategy could allow to separate the local options from the global ones? A new option named transport_options that could be directly passed to the underlying layer?
If that's fine for you, I could propose a PR. Let me know.
key is the only conflict, I'd rather rename it instead of having an indirection layer in the options, that's for consistence with the TCP and SSL APIs, they pass through the options of the layer below them.
About consistency, the bigger issue here is that you'll have to compose with some underlying layer options named differently than the original ones when they are passed through the web API. But that would be fine for me as I could use this library in my context :).