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
init
4 years ago
public init 4 years ago
src init 4 years ago
.gitignore init 4 years ago
README.md init 4 years ago
demo.gif init 4 years ago
mix-manifest.json init 4 years ago
package-lock.json init 4 years ago
package.json init 4 years ago
server.js init 4 years ago
webpack.mix.js init 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.

Demo

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;
    }
}