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) {
|
func sendMessage(message []byte, decode bool) {
|
||||||
chanel := ""
|
chanel := ""
|
||||||
if decode {
|
if decode {
|
||||||
var input map[string]interface{}
|
input := struct {
|
||||||
|
Chanel string `json:"chanel"`
|
||||||
|
}{}
|
||||||
if err := json.Unmarshal(message, &input); err != nil {
|
if err := json.Unmarshal(message, &input); err != nil {
|
||||||
fmt.Println("json error: ", err.Error())
|
fmt.Println("json error: ", err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if input["chanel"] != nil {
|
if input.Chanel != "" {
|
||||||
chanel = input["chanel"].(string)
|
chanel = input.Chanel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue