GithubHelp home page GithubHelp logo

go-tcp-messaging's Introduction

Description

This repo contains hub and client in separate packages. The concept of messaging is based on protobuf format. The client is supplemented with simple cli api. The technical requirements are here

Installation

You can build both client and hub with:

make get
make build

Usage

Start hub

./bin/hub

Start clients

./bin/client

Type help to get list of available commands

Assumptions

  1. User authentication. To authenticate users, I've chosen naive approach with simple integer counter, every new user gets an incremented integer as ID
  2. Messaging fashion. Client is sending requests and receiving responses and relays from server. Whenever client is sending request it blocks on responseChan and waits for asynchronous handler to write response in the responseChan.
  3. I've chosen protobuf as the most convenient protocol for network communication. Based on benchmarks from https://github.com/alecthomas/go_serialization_benchmarks github.com/gogo/protobuf seems like the most advanced in terms of memory allocations and speed.
  4. There's request timeout implemented in the code to terminate the unsuccessful requests.

Trade-Offs

  1. In the implementation there's no real multiplexing. Blocking on responseChan is somewhat fragile, since we are receiving messages asynchronously and don't know really if the received response is actually for our certain request. Though synchronous request send saves us from this issue. Multiplexing could be solved with streams, e.g. with: https://github.com/hashicorp/yamux
  2. Both client logging and CLI are using stdout for simplicity.

go-tcp-messaging's People

Contributors

antonzhukov avatar

Watchers

 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.