aboutsummaryrefslogtreecommitdiff
path: root/views/client.html
diff options
context:
space:
mode:
authorPacien TRAN-GIRARD2014-07-06 16:23:47 +0200
committerPacien TRAN-GIRARD2014-07-06 16:23:47 +0200
commit88d204c75200d3185dd70cc583e69f57f3550b09 (patch)
treed9e045a29af59c2a18c07247f9c38465327db1a4 /views/client.html
parent34eaf5c90ef315227114994a00d43228b33b55aa (diff)
downloadwebcastor-88d204c75200d3185dd70cc583e69f57f3550b09.tar.gz
Add authentication events
Diffstat (limited to 'views/client.html')
-rw-r--r--views/client.html22
1 files changed, 19 insertions, 3 deletions
diff --git a/views/client.html b/views/client.html
index c322042..ebb3810 100644
--- a/views/client.html
+++ b/views/client.html
@@ -5,6 +5,8 @@
5 <input type="text" id="channelField"> 5 <input type="text" id="channelField">
6 <label for="passwordField">Password (optional)</label> 6 <label for="passwordField">Password (optional)</label>
7 <input type="password" id="passwordField"> 7 <input type="password" id="passwordField">
8 <input type="checkbox" id="usePassword">
9 <label for="usePassword">Use password</label>
8 <input type="submit" value="Connect" id="connectButton"> 10 <input type="submit" value="Connect" id="connectButton">
9</form> 11</form>
10<br> 12<br>
@@ -43,9 +45,9 @@
43 var socket; 45 var socket;
44 var socketConnected = false; 46 var socketConnected = false;
45 47
46 function connectSocket(channel, password) { 48 function connectSocket(channel, password, authenticate) {
47 socket = io.connect("/", { 49 socket = io.connect("/", {
48 "query" : "channel=" + channel + "&password=" + password, 50 "query" : "channel=" + channel + ( authenticate ? "&password=" + password : ""),
49 "force new connection" : true 51 "force new connection" : true
50 }); 52 });
51 53
@@ -59,6 +61,20 @@
59 println("disconnected"); 61 println("disconnected");
60 }); 62 });
61 63
64 socket.on("unknown_channel", function() {
65 changeControlState(false);
66 println("unknown_channel");
67 });
68
69 socket.on("authentication_error", function() {
70 changeControlState(false);
71 println("authentication_error");
72 });
73
74 socket.on("authenticated", function() {
75 println("authenticated");
76 });
77
62 socket.on("message", function(message) { 78 socket.on("message", function(message) {
63 println(message); 79 println(message);
64 }); 80 });
@@ -70,7 +86,7 @@
70 if (socketConnected) { 86 if (socketConnected) {
71 socket.disconnect(); 87 socket.disconnect();
72 } else { 88 } else {
73 connectSocket(channelField.value, passwordField.value); 89 connectSocket(channelField.value, passwordField.value, usePassword.checked);
74 } 90 }
75 }); 91 });
76 92