feat 协议移动到Public

This commit is contained in:
2025-12-15 11:22:59 +08:00
parent 6e19d93f5e
commit 3498cf158d
45 changed files with 2730 additions and 929 deletions

View File

@@ -3,7 +3,7 @@ package ws_handler
import (
"common/log"
"common/net/socket"
"common/proto/gen/cs"
"common/proto/sc/sc_pb"
"context"
"fmt"
"go.uber.org/zap"
@@ -85,13 +85,13 @@ func (c *Client) OnEvent(event Event) {
}
// WriteMessage 向客户端发送消息
func (c *Client) WriteMessage(id cs.MessageID, data proto.Message) {
func (c *Client) WriteMessage(id sc_pb.MessageID, data proto.Message) {
d, err := proto.Marshal(data)
if err != nil {
c.logger.Errorf("WriteMessage proto.Marshal err: %v", err)
return
}
m, err := proto.Marshal(&cs.Message{
m, err := proto.Marshal(&sc_pb.Message{
ID: id,
Payload: d,
})
@@ -105,8 +105,8 @@ func (c *Client) WriteMessage(id cs.MessageID, data proto.Message) {
}
// WriteBytes 向客户端发送字节数据
func (c *Client) WriteBytes(id cs.MessageID, data []byte) {
m, err := proto.Marshal(&cs.Message{
func (c *Client) WriteBytes(id sc_pb.MessageID, data []byte) {
m, err := proto.Marshal(&sc_pb.Message{
ID: id,
Payload: data,
})