Remove TinyMce Added Squire

This commit is contained in:
Max G committed 2020-02-01 22:21:22 +00:00
1 parent 68effaa5c3
commit 133a86e09e
91 files changed
+6538 -10672

No files matched your search

+64
View File
@@ -7,6 +7,70 @@ const express = require('express')
const app = express()
const port = 3000
var http = require('http').createServer(app);
var io = require('socket.io')(http, {
path:'/socket'
});
// Make io accessible to our router
app.use(function(req,res,next){
req.io = io;
next();
});
io.on('connection', function(socket){
// console.log('New user ', socket.id)
socket.on('join_room', roomId => {
// console.log('Join room ', roomId)
socket.join(roomId)
const usersInRoom = io.sockets.adapter.rooms[roomId]
if(usersInRoom){
// console.log('Users in room', usersInRoom.length)
io.to(roomId).emit('update_user_count', usersInRoom.length)
}
})
socket.on('leave_room', roomId => {
socket.leave(roomId)
// console.log('User Left room')
const usersInRoom = io.sockets.adapter.rooms[roomId]
if(usersInRoom){
// console.log('Users in room', usersInRoom.length)
io.to(roomId).emit('update_user_count', usersInRoom.length)
}
})
socket.on('note_diff', data => {
//Each user joins a room when they open the app.
io.in(data.id).clients((error, clients) => {
if (error) throw error;
//Go through each client in note room and send them the diff
clients.forEach(socketId => {
if(socketId != socket.id){
io.to(socketId).emit('incoming_diff', data.diff)
}
})
});
})
socket.on('disconnect', function(){
// console.log('user disconnected');
});
});
http.listen(3001, function(){
console.log('socket.io liseting on port 3001');
});
//Enable json body parsing in requests. Allows me to post data in ajax calls
app.use(express.json({limit: '2mb'}))