gateway type replaced with anon struct.
This commit is contained in:
parent
dbfdae71e8
commit
2c758edf11
@ -9,11 +9,6 @@ import (
|
|||||||
"github.com/sacOO7/gowebsocket"
|
"github.com/sacOO7/gowebsocket"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Dummy struct for parse gateway events.
|
|
||||||
type GatewayType struct {
|
|
||||||
Type string `json:"type"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Client) Start() {
|
func (c *Client) Start() {
|
||||||
// Create new socket
|
// Create new socket
|
||||||
c.Socket = gowebsocket.New(WS_URL)
|
c.Socket = gowebsocket.New(WS_URL)
|
||||||
@ -26,7 +21,9 @@ func (c *Client) Start() {
|
|||||||
|
|
||||||
c.Socket.OnTextMessage = func(message string, _ gowebsocket.Socket) {
|
c.Socket.OnTextMessage = func(message string, _ gowebsocket.Socket) {
|
||||||
// Parse data
|
// Parse data
|
||||||
rawData := &GatewayType{}
|
rawData := &struct {
|
||||||
|
Type string `json:"type"`
|
||||||
|
}{}
|
||||||
err := json.Unmarshal([]byte(message), rawData)
|
err := json.Unmarshal([]byte(message), rawData)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user