Giter VIP home page Giter VIP logo

chittychat's Introduction

Hand-in3

Include a readme.md file that describes how to run your program.

  • Start server: go run server/server.go
  • Start client x and join the chat: go run client/client.go -cid x (replace x with an integer)
  • In the client's terminial,type any message to publish, type "leave" to leave the chat
  • To save logs in a file, start both server and client with "&>> log.txt" at the end of the command

Discuss, whether you are going to use server-side streaming, client-side streaming, or bidirectional streaming?

  • Use server-side streaming to receive messages from the server. because the client need to keep listening to the server, and the server need to broadcast all the the messages to all the clients.
  • Use simple RPC to send messsge from client to server. So only when a client need to send a message, this function will be called. This will save some resources.

Describe your system architecture - do you have a server-client architecture, peer-to-peer, or something else?

Use server-client architecture. The client send messages to the server, and the server broadcast the messages to all the clients.

Describe what RPC methods are implemented, of what type, and what messages types are used for communication

  • message ChatMessage: The message type used for communication between server and client. It contains the following fields:
    • senderId: the id of the sender
    • timestamp: the timestamp of the message
    • messageText: the content of the message
  • message ServerResponse: The message type used for giving response to the client. It contains the following fields:
    • timestamp: the timestamp of the message
    • result: true if the operation is successful, false otherwise
  • message ClientRequest: The message type used for sending request(join or leave) to the server. It contains the following fields:
    • clientId: the id of the sender
    • timestamp: the timestamp of the message
  • rpc ClientSend(ChatMessage) returns (ServerResponse): Simple RPC
    • ClientSend is used for publishing messages to the server. It returns a ServerResponse to indicate whether the operation is successful.
  • rpc ClientReceive(ClientRequest) returns (stream ChatMessage): Server-side streaming RPC
    • ClientReceive is used for receiving messages from the server. It returns a stream of ChatMessage. Server-side streaming RPC
  • rpc Join(ClientRequest) returns (ServerResponse): Simple RPC
    • Join is used for sending join request to the server.
  • rpc Leave(ClientRequest) returns (ServerResponse): Simple RPC
    • Leave is used for sending leave request to the server.

Describe how you have implemented the calculation of the Lamport timestamps

  • At the beginning the clock of server and all the clients are set to 0.
  • When a client join the server/leave the server/send a message, it will increase the clock by 1. Then attach the current client clock to the TimeStamp.
  • When a client receive a message, it will compare the clock of the message and its own clock, and set the clock to the max of the two clocks. Then increase the clock by 1.
  • When a server broadcast a message to the clients, it will increase the clock by 1. Then attach the current server clock to the ChatMessage.TimeStamp.
  • When a server receive a message, it will compare the clock of the message and its own clock, and set the clock to the max of the two clocks. Then increase the clock by 1.

Provide a diagram, that traces a sequence of RPC calls together with the Lamport timestamps, that corresponds to a chosen sequence of interactions: Client X joins, Client X Publishes, ..., Client X leaves. Include documentation (system logs) in your appendix.

alt text

  • see diagram.log

Provide a link to a Git repo with your source code in the report

https://github.itu.dk/HelloWorld/Hand-in3

Include system logs, that document the requirements are met, in the appendix of your report

  • see diagram.log

chittychat's People

Contributors

redpandaqaq 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.