Skip to content

Commit

Permalink
feat: support wss protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
dev6699 committed Aug 5, 2024
1 parent c9e5e38 commit 47b9bd1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion view/script.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
(() => {
const BASE64_PREFIX = "data:image/png;base64,"

const socket = new WebSocket("ws://" + window.location.host + "/ws");
const wsProtocol = window.location.protocol === 'https:' ? 'wss://' : 'ws://';

const socket = new WebSocket(wsProtocol + window.location.host + "/ws");
socket.onopen = () => {
console.log("Successfully Connected");
socket.send("Hi From the Client!");
Expand Down

0 comments on commit 47b9bd1

Please sign in to comment.