commit
This commit is contained in:
parent
4df35bbec6
commit
8bfbb031a1
8
.idea/.gitignore
vendored
8
.idea/.gitignore
vendored
@ -1,8 +0,0 @@
|
|||||||
# Default ignored files
|
|
||||||
/shelf/
|
|
||||||
/workspace.xml
|
|
||||||
# Editor-based HTTP Client requests
|
|
||||||
/httpRequests/
|
|
||||||
# Datasource local storage ignored files
|
|
||||||
/dataSources/
|
|
||||||
/dataSources.local.xml
|
|
6
.idea/vcs.xml
Normal file
6
.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
1
asedraw_client.lua
Symbolic link
1
asedraw_client.lua
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
/home/bruno/.config/aseprite/scripts/asedraw_client.lua
|
2
go.mod
2
go.mod
@ -2,4 +2,4 @@ module asedraw
|
|||||||
|
|
||||||
go 1.21
|
go 1.21
|
||||||
|
|
||||||
require github.com/gorilla/websocket v1.5.0
|
require github.com/gorilla/websocket v1.5.0 // indirect
|
||||||
|
18
main.go
18
main.go
@ -7,7 +7,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
var addr = flag.String("addr", "localhost:8080", "http service address")
|
var addr = flag.String("addr", "localhost:8797", "http service address")
|
||||||
|
|
||||||
var upgrader = websocket.Upgrader{} // use default options
|
var upgrader = websocket.Upgrader{} // use default options
|
||||||
|
|
||||||
@ -17,18 +17,20 @@ func echo(w http.ResponseWriter, r *http.Request) {
|
|||||||
log.Print("upgrade:", err)
|
log.Print("upgrade:", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer c.Close()
|
defer func(c *websocket.Conn) {
|
||||||
|
err := c.Close()
|
||||||
|
if err != nil {
|
||||||
|
log.Println("close: ", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}(c)
|
||||||
for {
|
for {
|
||||||
mt, message, err := c.ReadMessage()
|
mt, message, err := c.ReadMessage()
|
||||||
if err != nil {
|
|
||||||
log.Println("read:", err)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
log.Printf("recv: %s", message)
|
log.Printf("recv: %s", message)
|
||||||
err = c.WriteMessage(mt, message)
|
err = c.WriteMessage(mt, message)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("write:", err)
|
log.Println(err)
|
||||||
break
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user