add: websocket protocol now depends on http's
This commit is contained in:
		@ -14,7 +14,12 @@ class Channel {
 | 
			
		||||
 | 
			
		||||
	// reload = function to use when we receive a message
 | 
			
		||||
	async connect(reload) {
 | 
			
		||||
		let url = `wss://${window.location.host}/ws/chat/${this.channel_id}/`;
 | 
			
		||||
		let url = `
 | 
			
		||||
			${window.location.protocol == 'https' ? 'wss' : 'ws'}
 | 
			
		||||
			://${window.location.host}
 | 
			
		||||
			/ws/chat/
 | 
			
		||||
			${this.channel_id}/
 | 
			
		||||
		`;
 | 
			
		||||
 | 
			
		||||
		this.chatSocket = new WebSocket(url);
 | 
			
		||||
		this.chatSocket.onmessage = (event) =>{
 | 
			
		||||
 | 
			
		||||
@ -19,8 +19,13 @@ class MatchMaking
 | 
			
		||||
		if (!await this.client.isAuthentificate())
 | 
			
		||||
			return null;
 | 
			
		||||
		
 | 
			
		||||
		let url = `wss://${window.location.host}/ws/matchmaking/${mode}`;
 | 
			
		||||
		
 | 
			
		||||
		let url = `
 | 
			
		||||
			${window.location.protocol == 'https' ? 'wss' : 'ws'}
 | 
			
		||||
			://${window.location.host}
 | 
			
		||||
			/ws/matchmaking/
 | 
			
		||||
			${mode}
 | 
			
		||||
		`;
 | 
			
		||||
 | 
			
		||||
		this._socket = new WebSocket(url);
 | 
			
		||||
		
 | 
			
		||||
		this.searching = true;
 | 
			
		||||
@ -49,4 +54,4 @@ class MatchMaking
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export {MatchMaking}
 | 
			
		||||
export {MatchMaking}
 | 
			
		||||
 | 
			
		||||
@ -77,7 +77,12 @@ class Tourmanent
 | 
			
		||||
		if (!await this.client.isAuthentificate())
 | 
			
		||||
			return null;
 | 
			
		||||
		
 | 
			
		||||
		let url = `wss://${window.location.host}/ws/tournaments/${this.id}`;
 | 
			
		||||
		let url = `
 | 
			
		||||
			${window.location.protocol == 'https' ? 'wss' : 'ws'}
 | 
			
		||||
			://${window.location.host}
 | 
			
		||||
			/ws/tournaments/
 | 
			
		||||
			${this.id}
 | 
			
		||||
		`;
 | 
			
		||||
		
 | 
			
		||||
		this._socket = new WebSocket(url);
 | 
			
		||||
		
 | 
			
		||||
@ -97,4 +102,4 @@ class Tourmanent
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export { Tourmanent }
 | 
			
		||||
export { Tourmanent }
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user