connection_options.go raw
1 //go:build !js
2
3 package ws
4
5 import (
6 "crypto/tls"
7 "net/http"
8 "time"
9
10 "github.com/gorilla/websocket"
11 )
12
13 func getConnectionOptions(
14 requestHeader http.Header, tlsConfig *tls.Config,
15 ) *websocket.Dialer {
16 dialer := &websocket.Dialer{
17 ReadBufferSize: 1024,
18 WriteBufferSize: 1024,
19 TLSClientConfig: tlsConfig,
20 HandshakeTimeout: 10 * time.Second,
21 }
22 // Headers are passed directly to DialContext, not set on Dialer
23 // The User-Agent header will be set when calling DialContext if not present
24 return dialer
25 }
26