-
Notifications
You must be signed in to change notification settings - Fork 3
Project Structure
Marco Beltempo edited this page Feb 20, 2018
·
17 revisions
This hierarchy is based on the chaddon's master branch. Please update as new files and functions are added.
- src/
//[Deprecated] - sets the the dependencies being used
app.configure(function(){...})//[Deprecated] - determines how express handles errors in production and development mode
app.configure('{development | production}', function()...) //[Deprecated] - redirects user to 'views/index.html' when accessing the root. The use of sendFile() needs to be updated.
app.get('/', function(req, res) {
params = req.params.id;
res.sendfile('views/index.html', {root:__dirname});
});//[Deprecated] - redirects user to 'views/login.html'. The use of sendFile() needs to be updated.
app.get('/login', function(req, res) {
params = req.params.id;
res.sendfile('views/login.html', {root:__dirname});
});//[Deprecated] - parses the parameter following 'root/' and uses it as a page id. "views/chatroom.html" is then loaded. The use of sendFile() needs to be updated.
app.get('/:id', function(req, res) {
params = req.params.id;
res.sendfile('views/chatroom.html', {root:__dirname});
});// development mode uses `localhost:3000` | production mode uses the environment variable port
io = io.listen(app);
var port = process.env.PORT || 3000;//decodes url characters by replacing ASCII characters
function htmlEntities(str) {...}//activates the socket listener
//stores valid username in socket session
io.sockets.on('connection', function(socket){..}//adds the new user to the chatroom user list
io.sockets.in(socket.room).emit("updateUsers", {usernames:localUser[""+params]})//appends new message after clicking the "Send" button.
socket.on('message', function(msg) {...}//removes the user from the chatroom/ user list once they leave a chatroom
socket.on('disconnect', function() {...}See https://docs.npmjs.com/files/package.json for more info.
//listener is fired on run time to check if the add on icon has been clicked.
//on click the "getURL" function parses the URL and prints it to the developer console.
chrome.runtime.onMessage.addListener(
function getUrl (request, sender, sendResponse) { ... } )- (Coming Soon)