Compare commits
2 commits
98fcb3059a
...
ead73c1d0e
Author | SHA1 | Date | |
---|---|---|---|
ead73c1d0e | |||
9b7dc19935 |
4 changed files with 15 additions and 7 deletions
|
@ -34,3 +34,8 @@ tasks:
|
||||||
desc: Create a local snapshot release
|
desc: Create a local snapshot release
|
||||||
cmds:
|
cmds:
|
||||||
- goreleaser release --clean --snapshot
|
- goreleaser release --clean --snapshot
|
||||||
|
|
||||||
|
install:
|
||||||
|
desc: Install the latest published version locally
|
||||||
|
cmds:
|
||||||
|
- go install git.smsvc.net/pomodoro/ChronoTomato@latest
|
||||||
|
|
|
@ -8,7 +8,8 @@ import (
|
||||||
ChronoTomato "git.smsvc.net/pomodoro/ChronoTomato/pkg/models"
|
ChronoTomato "git.smsvc.net/pomodoro/ChronoTomato/pkg/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Client ChronoTomato.GoTomatoClient // New websocket client
|
// New websocket client
|
||||||
|
type Client ChronoTomato.GoTomatoClient
|
||||||
|
|
||||||
// Connects to websocket
|
// Connects to websocket
|
||||||
func Connect(url string) Client {
|
func Connect(url string) Client {
|
||||||
|
@ -17,10 +18,6 @@ func Connect(url string) Client {
|
||||||
return Client{Conn: conn, Server: url, LastErr: err}
|
return Client{Conn: conn, Server: url, LastErr: err}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c Client) Connected() bool {
|
|
||||||
return c.Conn != nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Disconnects from websocket
|
// Disconnects from websocket
|
||||||
func (c Client) Disconnect() {
|
func (c Client) Disconnect() {
|
||||||
// Cleanly close the connection by sending a close message and then
|
// Cleanly close the connection by sending a close message and then
|
||||||
|
@ -34,3 +31,7 @@ func (c Client) Disconnect() {
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c Client) Connected() bool {
|
||||||
|
return c.Conn != nil
|
||||||
|
}
|
||||||
|
|
|
@ -9,8 +9,6 @@ import (
|
||||||
GoTomato "git.smsvc.net/pomodoro/GoTomato/pkg/models"
|
GoTomato "git.smsvc.net/pomodoro/GoTomato/pkg/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
var Done = make(chan struct{})
|
|
||||||
|
|
||||||
// Receives websocket messages and writes them to a channel.
|
// Receives websocket messages and writes them to a channel.
|
||||||
// Closes the channel if websocket closes.
|
// Closes the channel if websocket closes.
|
||||||
func (c *Client) ProcessServerMessages(channel chan<- GoTomato.ServerMessage) {
|
func (c *Client) ProcessServerMessages(channel chan<- GoTomato.ServerMessage) {
|
||||||
|
|
4
internal/websocket/vars.go
Normal file
4
internal/websocket/vars.go
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
package websocket
|
||||||
|
|
||||||
|
// Websocket closure
|
||||||
|
var Done = make(chan struct{})
|
Loading…
Reference in a new issue