This commit is contained in:
Askill 2022-05-26 15:01:09 +02:00
parent fd7bd1c0e1
commit ee6d416611
2 changed files with 1 additions and 16 deletions

View File

@ -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 {

View File

@ -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"`
}