Client: add global AppSettings object
This commit is contained in:
parent
3993ae9c44
commit
98c89f0702
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
<h1>InstantChat</h1>
|
||||
|
||||
<script src="js/settings.js"></script>
|
||||
<script src="js/client.js"></script>
|
||||
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
// Constants and variables
|
||||
// const wsUri = "ws://localhost:32715";
|
||||
const wsUri = "wss://chat.glitch-in.space:443/ws/";
|
||||
"use strict";
|
||||
|
||||
class Client {
|
||||
constructor(wsUri) {
|
||||
|
|
@ -17,7 +15,7 @@ class Client {
|
|||
|
||||
// WebSocket event handlers
|
||||
onOpen(evt) {
|
||||
console.log("Connected to " + wsUri);
|
||||
console.log("Connected to " + this.wsUri);
|
||||
|
||||
// Send init command containing chat ID and nickname
|
||||
this.sendInit();
|
||||
|
|
@ -83,5 +81,6 @@ class Client {
|
|||
|
||||
// Run script after page is loaded
|
||||
$(function() {
|
||||
const wsUri = AppSettings.serverWsUri;
|
||||
let client = new Client(wsUri);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
"use strict";
|
||||
|
||||
// Global settings object
|
||||
const AppSettings = {
|
||||
// serverWsUri: "ws://localhost:32715",
|
||||
serverWsUri: "wss://chat.glitch-in.space:443/ws/",
|
||||
};
|
||||
Loading…
Reference in New Issue