Giter Club home page Giter Club logo

go-ws's Introduction

go-ws

this repo is Go Websocket app + Kafka client

Imgur

in above system desgin diagram,

this repo respones to create websocket service and connect to message queue using pub/sub model,

because we distribute conenctions for multiple websocket service instances,

each instance could boardcast msg to all clients they were connecting,

but other clients connected to other instances could't do that.

so we need a fast, low latency way to share messages,

in this demo, message queue responses to finish this job.

For personal reason, we select Kafka, but actually we think redis is a better choice in this case.

In Kafka

we know kafka could work like both queue and pub/sub model,

so we distinguish each instance for separated groups

when a message comes in, instance would push to fixed topic,

thus, other group subscribled same topic will receive message immediately

thst's what we want to do.

TO-DO

each instance all subscribe same topic, so even the msg was sent by this instance

we still received it, we should skip this duplicate msg, it's not hard, just leave it for future.

Reference

most websocket related code is from gorilla/websocket example for chat room, appreciate!

go-ws's People

Contributors

tingyuchang avatar

Watchers

James Cloos avatar  avatar  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.