This repository has been archived on 2026-01-07. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Game/Server/Gateway/handler/ws_handler/temp.go

31 lines
495 B
Go

package ws_handler
import "encoding/json"
type tempMsg struct {
Type string `json:"type"`
Data string `json:"data"`
}
type tempAction struct {
Action int `json:"action"`
Data string `json:"data"`
}
type tempActionMove struct {
Move int `json:"move"`
}
func parseMsg(data []byte) (*tempMsg, error) {
m := &tempMsg{}
if err := json.Unmarshal(data, m); err != nil {
return nil, err
}
return m, nil
}
func wapMsg(m *tempMsg) []byte {
data, _ := json.Marshal(m)
return data
}