A small project for a simple chatroom using golang.

Overview

chatroom_go

A small project for a simple chatroom using golang.

项目编码流程的设计分析

通讯逻辑示意图

image

客户端部分

客户端登录功能

1.接收的输入id和密码

2.接收服务端的返回结果

3.判断是成功还是失败,并显示对应的页面

客户端发送消息流程

1.创建一个Message的结构体,结构体存放消息的类型和消息本身的数据(要有用户名和密码)

2.mes.Type = 登录的消息类型

3.mes.Data = 登录消息的内容

4.对mes和mes.Data进行序列化

5.在网络传输中,最麻烦的就是丢包问题

(1)先给服务器发送mes的长度【有多少字节】

(2)再发送消息本身

6.等待服务端发送是否合法的指令loginResMes。

服务端部分

服务端验证登录部分

1.接收用户的id密码,这里要开启协程,处理多个请求

2.验证用户的用户名和密码

3.返回结果

服务端接收数据的流程

1.接收客户端发送的长度以及Message的结构体的

2.接收时候要判断实际接收到的消息内容是否等于这个长度len,如果不等于就是丢包了,不相等就设置纠错协议

3.取到后对mes进行反序列化,得到原本的mes

4.再取出message.Data进行反序列化

5.取出loginMes.userId和login.userPwd

6.验证登录是否合法,返回给客户端序列化后的loginResMes(该变量用来表示是否合法)

Owner
Ripple
@OSSDAO-ORG•AIRDROP-0xA1a5F57f6042eFCB85087779707d654D6f14B1ba
Ripple
Moby Project - a collaborative project for the container ecosystem to assemble container-based systems

The Moby Project Moby is an open-source project created by Docker to enable and accelerate software containerization. It provides a "Lego set" of tool

Moby 63.4k Jun 24, 2022
Placeholder for the future project (lets-go-chat)Placeholder for the future project (lets-go-chat)

Placeholder for the future project (lets-go-chat)Placeholder for the future project (lets-go-chat)

null 0 Jan 10, 2022
A boilerplate/starter project for quickly building APIs using Golang with Clean Architechture

A boilerplate/starter project for quickly building APIs using Golang with Clean Architechture

Nyoman Frastyawan 1 Mar 2, 2022
PKSUID is a small extension for KSUID (K-Sortable Globally Unique IDs) which allows prefixing it with arbitrary up to 16 bytes strings

PKSUID is a small extension for KSUID (K-Sortable Globally Unique IDs) which allows prefixing it with arbitrary up to 16 bytes strings

Velmie 1 Feb 6, 2022
A small web dashboard with stats for all pipelines of Buildkite organization.

Buildkite Stats A small Buildkite dashboard useful to prioritize which pipelines a Buildkite organization is waiting the most on. Noteworthy details:

Jens Rantil 1 Apr 25, 2022
A small API to be used in Traefik Forward Auth to block attacks on services behind your favorite web router

Dynamic IPs Blacklist for Traefik This small software implements the possibility to block access to all the services behind your Traefik service. The

LoreLLo 0 Dec 21, 2021
Graphical small-internet client for windows, linux, MacOS X and BSDs. Supports gemini, http, https, gopher, finger.

Graphical small-internet client for windows, linux, MacOS X and BSDs. Supports gemini, http, https, gopher, finger.

Felix Queißner 537 Jun 17, 2022
Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like.

Advent of Code 2021 Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved

Kemal Ogun Isik 0 Dec 2, 2021
A little tool to create small QR code cards for vaccination/test proof.

Icedream's fancy vaccination/test certificate card tool This is just a tool I wrote to transform my vaccine certificate QR codes into something I can

Carl Kittelberger 0 Dec 16, 2021
Zach Howell 0 Jan 4, 2022
Catfetch is a small and cute fetch program written in Go

??Catfetch is a small and cute fetch program written in Go

mellowmarshe 12 Jun 27, 2022
Spellingbee - A small Go program to generate solutions to the NYT Spelling Bee

Spellingbee solver A small Go program for generating solutions to the ]New York

Seth Vargo 2 Jan 31, 2022
A simple and sussy project is an implementation of SOMMIP Lab 1 written in Golang

SOMMIP Lab 1 Isac Arthur Table of Contents About The Project Getting Started Prerequisites Installation Supported commands About The Project This very

Arthur 1 Nov 10, 2021
This is a simple project for demonstrating Temporal with the Go SDK.

This is a simple project for demonstrating Temporal with the Go SDK.

null 0 Oct 11, 2021
The phylosophy behind readyGo is "A Simple configuration should give a working project.".

The phylosophy behind readyGo is "A Simple configuration should give a working project.". readyGo is a command line interface( probably the name of re

Matta Manoghna Venkata Sai Rithvik 0 Oct 30, 2021
Ultra simple project scaffolding

?? You can help the author become a full-time open-source maintainer by sponsoring him on GitHub. aho ultra simple project scaffolding Install curl -f

EGOIST 62 Jun 6, 2022
A simple project/module generated tool written in go

A module generator written in go This is a project/module generator written in go. It is intended to generate standard project/module layouts in the t

CuriousNick 0 Dec 6, 2021
Golang-module-references - A reference for how to setup a Golang project with modules - Task Management + Math Examples

Golang Module Project The purpose of this project is to act as a reference for setting up future Golang projects using modules. This project has a mat

Bob Bass 0 Jan 2, 2022
simple bank which is implemented using Golang

Banker The service that we’re going to build is a simple bank. It will provide APIs for the frontend to do following things: Create and manage bank ac

null 1 Nov 15, 2021