Skip to content

Commit

Permalink
feat: Add chatroom folder structure and description
Browse files Browse the repository at this point in the history
- Add chatroom folder struct

#17
  • Loading branch information
lc-1010 committed Jul 29, 2023
1 parent 9c6fbae commit ffa4d48
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 54 deletions.
101 changes: 47 additions & 54 deletions chatroom/README.md
Original file line number Diff line number Diff line change
@@ -1,64 +1,57 @@
## ChartRoom
# ChartRoom

- 主要功能
聊天室在线人数、在线列表
昵称、头像设置
发送/接收消息
进入、退出聊天室
不同消息类型的支持:文字、表情、图片、语音、视频等
敏感词过滤
黑名单/禁言
聊天室信息
创建、修改聊天室
聊天室信息存储和历史消息查询
...

## 基于tcp的聊天室

- 如果大量用户广播延迟问题
- 消息的堵塞

## 目录

- tcp 实现了tcp版本的wesocket
- webscocket 使用不同的库,性能上对比,似乎gobwas 是比较优于其他
- chatroom 是完整版本的main
- logic 存放核心业务逻辑和service 目录类似
- server 存放server相关代码,类似于存放controller 的代码
- template 存放静态代码文件

```md
├── chatroom
│ ├── client
│ │ ├── client.go
│ │ └── client_test.go
│ ├── server
│ │ ├── server.go
│ │ └── server_test.go
│ └── README.md
.
├── README.md
├── cmd
│ ├── gateway
│ ├── multiple
│ └── rpc
├── configs
│ └── config.yaml
├── docker
├── docs
├── global
├── go.mod
├── go.sum
├── internal
│ ├── dao
│ ├── middleware
│ ├── model
│ ├── routers
│ ├── service
│ └── chatroom
│ ├── client
│ │ ├── client.go
│ │ └── client_test.go
│ ├── server
│ │ ├── server.go
│ │ └── server_test.go
│ └── README.md
├── main.go
├── pkg
│ ├── app
│ ├── blog_api
│ ├── convert
│ ├── email
│ ├── errcode
│ ├── limiter
│ ├── logger
│ ├── metatext
│ ├── setting
│ ├── swagger
│ ├── tracer
│ ├── upload
│ └── util
├── proto
├── queue.md
├── scripts
│ ├── chatroom
│ ├── tcp
│ │ ├── client
│ │ │ ├── client.go
│ │ │ └── client_test.go
│ │ └── server
│ │ ├── server.go
│ │ └── server_test.go
│ └── websocket
│ ├── gobwas
│ │ ├── client
│ │ │ ├── clinet.go
│ │ │ └── clinet_test.go
│ │ └── server
│ │ └── server.go
│ └── nhooyr
│ ├── client
│ │ └── client.go
│ └── server
│ └── server.go
├── logic
├── server
├── storage
└── third_party

└── template
```
44 changes: 44 additions & 0 deletions chatroom/cmd/chatroom/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package main

import (
"fmt"
"log"
"net/http"

"github.com/lc-1010/OneBlogService/chatroom/server"
)

var (
addr = ":2023"
banner = `
: o o ;
: \_'/
'_|__|_'
/_____\
|||||||
_'' ' ' ''_
_.-'_:______/:_'-._
_..-' [______/] '-.._
_-' [ ] '-_
_.=' [#] [#] '=._
[#] [#]
| |
\ /
\ \__/\__/ /
'-._|##|##|_.-'
|##|##|
_/##|##|\_
/____/|__|\
| /___\|##|
|| \#|##/ ||
||| \#/ |||
`
)

func main() {

fmt.Printf(banner+"\n", addr)
server.RegisterHandle()
log.Fatal(http.ListenAndServe(addr, nil))
}
10 changes: 10 additions & 0 deletions chatroom/cmd/websocket/gobwas/client/clinet_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package main

import (
"testing"
)

func Test_main(t *testing.T) {
//testgoog()

}
5 changes: 5 additions & 0 deletions chatroom/server/handle.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package server

func RegisterHandle() {

}

0 comments on commit ffa4d48

Please sign in to comment.