Skip to content

Commit

Permalink
add support for wss
Browse files Browse the repository at this point in the history
  • Loading branch information
Florent CARRE authored and Florent CARRE committed Mar 2, 2024
1 parent 63188a8 commit 29acd6c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions frontend/src/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ export default createStore({
const participant = state.room.voters.find(p => p.id === payload.id);
if (participant) {
participant.vote = payload.vote;
// participant.room = state.room.name;
} else {
console.error(`No participant found with ID ${payload.id}`);
}
Expand All @@ -98,7 +97,8 @@ export default createStore({
actions: {
connectToWebSocket({ commit }, serverAddress: string) {
try {
const websocket = new WebSocket(`ws://${serverAddress}/ws`);
const wsProtocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
const websocket = new WebSocket(`${wsProtocol}//${serverAddress}/ws`);
websocket.addEventListener('open', () => {
console.log('WebSocket is connected');
});
Expand Down

0 comments on commit 29acd6c

Please sign in to comment.