Added code to the admin part of the site - still non-functional. Need to fix JSON streaming over HTTP such that native types (boolean, Date, int) are preserved for the DB; Need to finish the restore functionality & the hide/show of the edit, delete, and restore buttons on each editor page.
29 lines
530 B
JavaScript
29 lines
530 B
JavaScript
//Server side brainstorm.
|
|
|
|
module.exports = function(server, sequelize) {
|
|
var io = require('socket.io')(server);
|
|
|
|
io.on('connection', function(socket) {
|
|
//TODO: Handle new connections.
|
|
|
|
//socket.emit("name", {param: 'value'});
|
|
|
|
//socket.on("name", function(data) {});
|
|
socket.on("query", function(params) {
|
|
var model = sequelize.models[params.class];
|
|
|
|
if(model) {
|
|
model.findAll().then(function(values) {
|
|
|
|
});
|
|
}
|
|
else {
|
|
|
|
}
|
|
});
|
|
|
|
socket.on('disconnect', function() {
|
|
//TODO: ?
|
|
});
|
|
});
|
|
}; |