Skip to content

Commit cf9540a

Browse files
shilderztellman
authored andcommitted
Added ssl-option for WebSocket client (#419)
Same as for http-connection
1 parent d83648d commit cf9540a

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/aleph/http.clj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@
193193
|:---|:---
194194
| `raw-stream?` | if `true`, the connection will emit raw `io.netty.buffer.ByteBuf` objects rather than strings or byte-arrays. This will minimize copying, but means that care must be taken with Netty's buffer reference counting. Only recommended for advanced users.
195195
| `insecure?` | if `true`, the certificates for `wss://` will be ignored.
196+
| `ssl-context` | an `io.netty.handler.ssl.SslContext` object, only required if a custom context is required
196197
| `extensions?` | if `true`, the websocket extensions will be supported.
197198
| `sub-protocols` | a string with a comma seperated list of supported sub-protocols.
198199
| `headers` | the headers that should be included in the handshake

src/aleph/http/client.clj

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,7 @@
690690
[uri
691691
{:keys [raw-stream?
692692
insecure?
693+
ssl-context
693694
headers
694695
local-address
695696
bootstrap-transform
@@ -734,9 +735,10 @@
734735
(.addLast "handler" ^ChannelHandler handler)
735736
pipeline-transform))
736737
(when ssl?
737-
(if insecure?
738-
(netty/insecure-ssl-client-context)
739-
(netty/ssl-client-context)))
738+
(or ssl-context
739+
(if insecure?
740+
(netty/insecure-ssl-client-context)
741+
(netty/ssl-client-context))))
740742
bootstrap-transform
741743
(InetSocketAddress.
742744
(.getHost uri)

0 commit comments

Comments
 (0)