@@ -198,6 +198,38 @@ is an optional hash containing any of these keys:
198
198
These are passed along to EventMachine and you can find
199
199
[ more details here] ( http://rubydoc.info/gems/eventmachine/EventMachine%2FConnection%3Astart_tls )
200
200
201
+ ### Secure sockets
202
+
203
+ Starting with version 0.11.0, ` Faye::WebSocket::Client ` will verify the server
204
+ certificate for ` wss ` connections. This is not the default behaviour for
205
+ EventMachine's TLS interface, and so our defaults for the ` :tls ` option are a
206
+ little different.
207
+
208
+ First, ` :verify_peer ` is enabled by default. Our implementation checks that the
209
+ chain of certificates sent by the server is trusted by your root certificates,
210
+ and that the final certificate's hostname matches the hostname in the request
211
+ URL.
212
+
213
+ By default, we use your system's root certificate store by invoking
214
+ ` OpenSSL::X509::Store#set_default_paths ` . If you want to use a different set of
215
+ root certificates, you can pass them via the ` :root_cert_file ` option, which
216
+ takes a path or an array of paths to the certificates you want to use.
217
+
218
+ ``` ruby
219
+ ws = Faye ::WebSocket ::Client .new (' wss://example.com/' , [], :tls => {
220
+ :root_cert_file => [' path/to/certificate.pem' ]
221
+ })
222
+ ```
223
+
224
+ If you want to switch off certificate verification altogether, then set
225
+ ` :verify_peer ` to ` false ` .
226
+
227
+ ``` ruby
228
+ ws = Faye ::WebSocket ::Client .new (' wss://example.com/' , [], :tls => {
229
+ :verify_peer => false
230
+ })
231
+ ```
232
+
201
233
## WebSocket API
202
234
203
235
Both the server- and client-side ` WebSocket ` objects support the following API:
0 commit comments