
I start my server and refresh the page in the browser, and then it takes> 2s to load the JS resource. If I reload the page in any browser, it loads quickly.
This only happens on the first request after starting the server. I believe this is due to the fact that it first collects the JS file, and then after that it is cached on the server.
Is there anything you can do to reduce this time?
I tried both with production settings and without them (gzip, minify, etc.).
Client Code:
<script src="/socket.io/socket.io.js"></script> <script> var socket = io.connect(); </script>
Server Code:
var express = require('express'), expressServer = express.createServer(), socketServer = require('socket.io').listen(expressServer); expressServer.listen(1337);
Znarkus
source share