mirror of https://github.com/Askill/r_place.git
clean up
This commit is contained in:
parent
fd7bd1c0e1
commit
ee6d416611
15
go/server.go
15
go/server.go
|
|
@ -8,7 +8,6 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"flag"
|
||||
"log"
|
||||
"net/http"
|
||||
|
|
@ -24,20 +23,6 @@ var upgrader = websocket.Upgrader{
|
|||
WriteBufferSize: 2048,
|
||||
}
|
||||
|
||||
type Pixel struct {
|
||||
X uint16 `json:"x"`
|
||||
Y uint16 `json:"y"`
|
||||
Color uint8 `json:"color"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
UserID uint64 `json:"userid"`
|
||||
}
|
||||
|
||||
func JsonToStruct(input []byte) Pixel {
|
||||
pixel := Pixel{}
|
||||
json.Unmarshal(input, &pixel)
|
||||
return pixel
|
||||
}
|
||||
|
||||
func serve(w http.ResponseWriter, r *http.Request) {
|
||||
c, err := upgrader.Upgrade(w, r, nil)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ type Pixel struct {
|
|||
X uint16 `json:"x"`
|
||||
Y uint16 `json:"y"`
|
||||
Color uint8 `json:"color"`
|
||||
Timestamp uint64 `json:"timestamp"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
UserID uint64 `json:"userid"`
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue