Skip to content

Commit c174672

Browse files
committed
Simple functional code added
works with the Sample SQLite Viewer Sample App
1 parent f2d1b66 commit c174672

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

server.js

+18-11
Original file line numberDiff line numberDiff line change
@@ -38,25 +38,26 @@ socketio.on("connection",function (socket) {
3838

3939

4040
//Emit databases names
41-
socket.on("get:database",function(data){
41+
socket.on("get:databases",function(data){
4242
console.log("[Interface] : list databases");
4343
// ask service to emit then database names
44-
45-
44+
socket.broadcast.emit("get:databases");
4645

4746
});
4847

4948
//Emit table names from database given
50-
socket.on("get:table",function(data){
49+
socket.on("get:tables",function(data){
5150
console.log("[Interface] : list tables");
52-
//socket.emit("get:table",);
51+
// ask service to emit then table names
52+
socket.broadcast.emit("get:tables",data);
5353
});
5454

5555

5656
//Emit fields and data based on the table names from database given
5757
socket.on("get:table:data",function(data){
5858
console.log("[Interface] : list fields and data");
59-
//socket.emit("get:table:data",);
59+
// ask service to emit then data inside the tables
60+
socket.broadcast.emit("get:table:data",data);
6061
});
6162

6263

@@ -68,23 +69,29 @@ socketio.on("connection",function (socket) {
6869
//Service Events
6970

7071
socket.on("service:send:databases",function(data){
71-
console.log("[Service] : Sent Databases");
7272

73+
console.log("[Service] : Sent Databases");
74+
7375
// Emit/Send the databases to the Interface
76+
socket.broadcast.emit("service:send:databases",data);
7477

7578
});
7679

77-
socket.on("service:send:Tables",function(data){
80+
socket.on("service:send:tables",function(data){
81+
7882
console.log("[Service] : Sent Tables");
7983

80-
// Emit/Send the tables to the Interface
84+
// Emit/Send the tables to the Interface
85+
socket.broadcast.emit("service:send:tables",data);
8186

8287
});
8388

84-
socket.on("service:send:fields and Data",function(data){
85-
console.log("[Service] : Sent fields and Data");
89+
socket.on("service:send:data",function(data){
90+
91+
console.log("[Service] : Sent fields and Data");
8692

8793
// Emit/Send the fields and data to the Interface
94+
socket.broadcast.emit("service:send:data",data);
8895

8996
});
9097

0 commit comments

Comments
 (0)