Skip to content

Commit

Permalink
fix #37
Browse files Browse the repository at this point in the history
  • Loading branch information
zAlweNy26 committed Mar 6, 2024
1 parent 224171c commit 36d3183
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/ten-badgers-shake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ccat-api": patch
---

Fix websocket scheme not supported in the browser
3 changes: 2 additions & 1 deletion api/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ export class CatClient {
...this.config.ws
} satisfies WebSocketSettings
const user = this.config.user ?? 'user'
this.ws = new WebSocket(`${this.url}${wsConfig.path}/${user}${wsConfig.query}`)
const url = this.url.replace(/http/g, 'ws')
this.ws = new WebSocket(`${url}${wsConfig.path}/${user}${wsConfig.query}`)
this.ws.onopen = () => {
this.connectedHandler?.()
}
Expand Down

0 comments on commit 36d3183

Please sign in to comment.