mirror of
https://github.com/unitoftime/rtcnet.git
synced 2025-10-28 18:44:45 +08:00
23 lines
395 B
Go
23 lines
395 B
Go
// +build !js
|
|
|
|
package rtcnet
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
"crypto/tls"
|
|
|
|
"nhooyr.io/websocket"
|
|
)
|
|
|
|
func dialWs(ctx context.Context, url string, tlsConfig *tls.Config) (*websocket.Conn, error) {
|
|
wsConn, _, err := websocket.Dial(ctx, url, &websocket.DialOptions{
|
|
HTTPClient: &http.Client{
|
|
Transport: &http.Transport{
|
|
TLSClientConfig: tlsConfig,
|
|
},
|
|
},
|
|
})
|
|
return wsConn, err
|
|
}
|