Giter Site home page Giter Site logo

spkorhonen / websockets-scaling Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sw360cab/websockets-scaling

0.0 1.0 0.0 238 KB

A tutorial to scale Websockets both via Docker Swarm and Kubernetes

License: MIT License

JavaScript 85.46% Dockerfile 14.54%

websockets-scaling's Introduction

Scaling websockets

Intro

Purpose of this is achieving a scalable environment when WebSocket are involved. The pattern to reproduce is a Multi-Server to Multi-client communication via websocket.

The result should be a client connected to a specific server host and keeping its connection bound to it (sticky connection). Whereas the server hosts will broadcast messages in turn and all the connected clients should receive them. The latter will be achieved leveraging the pub/sub paradigm of Redis.

The application is made of server and client part. Both are based socket.io library.

Server

  • it employs a dedicated adapter implementing native Redis support.
  • an instance will advertise periodically its private ip. NOTE that this message should be received by ALL the clients connected.

Client

  • it is configured to employ native websockets, without attempting to use naïfes solutions as http polling.

    { transports: ['websocket'] }
    
  • it will send a message to a single server instance at connection time. NOTE that this message should be received only by a single server instance.

Stack of Microservices Scenario

See Stack configuration.

Kubernates Scenario

See Kubernates configuration.

References

websockets-scaling's People

Contributors

sw360cab avatar dependabot[bot] avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.