Skip to content

Commit

Permalink
Fixed ws issue
Browse files Browse the repository at this point in the history
  • Loading branch information
unownone committed May 3, 2022
1 parent e12fd59 commit 0e99845
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions views/chats.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ <h3 id="chat_heading">No chat Selected</h3>
}),
success: function(data){
localStorage.setItem("access_token", data.access_token);
window.location.href = "/chat";
window.location.reload();
},
error: function(data) {
window.location.href = "/login";
Expand Down Expand Up @@ -128,7 +128,10 @@ <h3 id="chat_heading">No chat Selected</h3>
console.log("no socket to close");
}
$("#chat_heading").html(name);
socket = new WebSocket("ws://"+"{{.HOST}}"+":"+"{{.PORT}}"+"/api/v1/chat/"+localStorage.getItem("access_token")+"/"+id);
var hst = "{{.HOST}}";
var prt = "{{.PORT}}";
console.log(hst)
socket = new WebSocket(`ws://${hst}:${prt}/api/v1/chat/${localStorage.getItem("access_token")}/id`);
console.log("Socket Opened!");
curr = id;
socket.onopen = function(e) {
Expand Down

0 comments on commit 0e99845

Please sign in to comment.