express-socketio-tutorial | simple express socket.io tutorial using express | Socket library
kandi X-RAY | express-socketio-tutorial Summary
kandi X-RAY | express-socketio-tutorial Summary
A simple express socket.io tutorial using express generators.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of express-socketio-tutorial
express-socketio-tutorial Key Features
express-socketio-tutorial Examples and Code Snippets
Community Discussions
Trending Discussions on express-socketio-tutorial
QUESTION
I refer this repo to integrate socket.io.
What I want to achieve is, a countdown timer, which send to client every second, setInterval
is run on server side. The result I get is
The terminal there is on.('connection')
, first time I refresh the page, it executed 4 times on.('connection')
, the countdown is working fine. Then I refresh 2nd time, it executed 8 times on.('connection')
, and the countdown timer also have 2 values there. Then continue.... 12 times, 16 times...
In app.js
...ANSWER
Answered 2017-Mar-28 at 06:50I think you probably your keeping io.on('connection')
event within setInterval. That's why it every time keeps on replication in *2.
You can do it like this if you want to achieve countdown timer :
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install express-socketio-tutorial
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page