Coder Social home page Coder Social logo

Comments (1)

salvacorts avatar salvacorts commented on August 26, 2024 1

Tener un socket abierto en el servidor por cada nodo no escala bien. Una buena alternativa puede ser utilizar el estandar Server-sent events [1] en el cual un cliente se subscribe a un servicio de notificaciones del servidor.

Para un cliente web, la implementación es trivial [1,2] pero para el caso de clientes nativos no hay muchos recursos disponibles a excepción de en Java [3,4] y más concretamente Android [5].

Sin embargo, hay un proyecto interesante de código abierto llamado Plasma [6] que actua como middleware entre un servidor que publica mensajes y clientes que los leen. El servidor publica mensajes enviando mediante gRPC dicho mensaje a Plasma y este lo reenvía a los clientes subscritos. El cliente puede subscribirse a un evento del servidor mediante gRPC si es un cliente nativo, o de la forma sencilla si es un cliente web [2].

gRPC esta disponible para distintos lenguajes nativos [7]. Lo que nos permite usar esta forma de comunicación tambien en clientes nativos.

[1] https://html.spec.whatwg.org/multipage/server-sent-events.html
[2] https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events
[3] https://golb.hplar.ch/2018/02/Access-Server-Sent-Events-from-Java.html
[4] https://github.com/launchdarkly/okhttp-eventsource
[5] https://github.com/tylerjroach/eventsource-android
[6] https://github.com/openfresh/plasma
[7] https://grpc.io/docs/tutorials/basic/c.html

from gocey.

Related Issues (20)

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.