summaryrefslogtreecommitdiff
path: root/bilibili/connect.go
diff options
context:
space:
mode:
Diffstat (limited to 'bilibili/connect.go')
-rw-r--r--bilibili/connect.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/bilibili/connect.go b/bilibili/connect.go
new file mode 100644
index 0000000..472c979
--- /dev/null
+++ b/bilibili/connect.go
@@ -0,0 +1,13 @@
+package bilibili
+
+import (
+ "context"
+ "nhooyr.io/websocket"
+)
+
+func (b Bilibili) DialWebSocket(ctx context.Context, url string) (*websocket.Conn, error) {
+ ws, _, err := websocket.Dial(ctx, url, &websocket.DialOptions{
+ HTTPClient: b.http,
+ })
+ return ws, err
+}