mirror of
https://github.com/statbate/supreme-disco.git
synced 2026-08-11 03:22:41 +00:00
interface to struct
This commit is contained in:
parent
12e5ac6f68
commit
db66cde2fe
1 changed files with 5 additions and 3 deletions
|
|
@ -78,13 +78,15 @@ func broadcast() {
|
|||
func sendMessage(message []byte, decode bool) {
|
||||
chanel := ""
|
||||
if decode {
|
||||
var input map[string]interface{}
|
||||
input := struct {
|
||||
Chanel string `json:"chanel"`
|
||||
}{}
|
||||
if err := json.Unmarshal(message, &input); err != nil {
|
||||
fmt.Println("json error: ", err.Error())
|
||||
return
|
||||
}
|
||||
if input["chanel"] != nil {
|
||||
chanel = input["chanel"].(string)
|
||||
if input.Chanel != "" {
|
||||
chanel = input.Chanel
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue