Skip to content

Commit

Permalink
feat: support headers options with submit cookie
Browse files Browse the repository at this point in the history
  • Loading branch information
starknt committed Jul 7, 2024
1 parent f47fc53 commit 3aaec14
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/base/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ interface CustomWebSocket {
}

export interface WSOptions extends BaseOptions, AuthOptions, ConnectionOptions {
headers?: { [key: string]: string } | undefined

ssl?: boolean
platform?: 'web' | string
protover?: 1 | 2 | 3
Expand Down
8 changes: 6 additions & 2 deletions src/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,9 @@ export class KeepLiveWS<E extends Record<EventKey, any> = object> extends LiveCl
}
}
else {
socket = new WebSocket(_url)
socket = new WebSocket(_url, {
headers: options.headers,
})
socket.binaryType = 'arraybuffer'
}
if (socket) {
Expand Down Expand Up @@ -304,7 +306,9 @@ export class KeepLiveWS<E extends Record<EventKey, any> = object> extends LiveCl
}
}
else {
socket = new WebSocket(url)
socket = new WebSocket(url, {
headers: options.headers,
})
socket.binaryType = 'arraybuffer'
}

Expand Down

0 comments on commit 3aaec14

Please sign in to comment.