3
0
Files
corteza/sam/websocket/outgoing/connection.go
2018-07-29 01:06:36 +02:00

26 lines
419 B
Go

package outgoing
import (
"encoding/json"
)
type (
Connected struct {
// Who did connect?
UserID string `json:"uid"`
}
Disconnected struct {
// Who did disconnect?
UserID string `json:"uid"`
}
)
func (p *Connected) EncodeMessage() ([]byte, error) {
return json.Marshal(Payload{Connected: p})
}
func (p *Disconnected) EncodeMessage() ([]byte, error) {
return json.Marshal(Payload{Disconnected: p})
}