Posts

Showing posts with the label ejs

Socket.io namespace stops working after 10 connections

Socket.io namespace stops working after 10 connections I'm using node.js, ejs, express, mysql and socket.io. My server looks like this (index.js): module.exports = function(io) { var express = require('express'); var router = express.Router(); var mysql = require('mysql'); var pool = mysql.createPool({ connectionLimit: 10, host: 'localhost', user: 'root', password: '', database: 'chat' }); router.get('/chat/:channel_name', (req, res, next) => { var channel_name = req.params.channel_name; // get the countries from the database so we make sure the users are connecting to the correct channel to chat, else redirect to /chat pool.getConnection((err, connection) => { if(err) return console.log(err); connection.query('SELECT * FROM channel WHERE channel_name = ?', channel_name, (err, rows) => { if(err) return console.log(err) if(!rows.length){ ...