You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Björn
d3a358b03a
|
4 years ago | |
---|---|---|
public | 4 years ago | |
src | 4 years ago | |
.gitignore | 4 years ago | |
README.md | 4 years ago | |
demo.gif | 4 years ago | |
mix-manifest.json | 4 years ago | |
package-lock.json | 4 years ago | |
package.json | 4 years ago | |
server.js | 4 years ago | |
webpack.mix.js | 4 years ago |
README.md
Lessons Learned: Realtime User with Socket.IO
Simple Webapp to show how many Clients are on a Site, using https://socket.io/ and Nodejs as Server.
npm install
node server.js
If you use nginx,
upstream socketio {
server 0.0.0.0:3000;
}
server {
listen 80;
listen [::]:80;
# Host that will serve this project.
server_name <domain>;
# The location of our projects public directory.
root <path>/public;
# index File
index index.html;
# rewrite
location / {
try_files $uri $uri/ /index.html?it=$uri&$args;
}
location /socket.io {
proxy_pass http://socketio;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}