moved websocket code to websocket package

This commit is contained in:
Sam Lewis
2022-10-11 22:58:44 -04:00
parent b3e45f46a4
commit 4cf16d0d41
4 changed files with 108 additions and 111 deletions

View File

@@ -4,7 +4,7 @@ import (
"context"
"github.com/saml-dev/gome-assistant/internal/http"
"github.com/saml-dev/gome-assistant/internal/setup"
ws "github.com/saml-dev/gome-assistant/internal/websocket"
"nhooyr.io/websocket"
)
@@ -28,12 +28,12 @@ type LightRequest struct {
func (l Light) TurnOn(entityId string) {
req := newLightOnRequest(entityId)
setup.WriteMessage(req, l.conn, l.ctx)
ws.WriteMessage(req, l.conn, l.ctx)
}
func (l Light) TurnOff(entityId string) {
req := newLightOffRequest(entityId)
setup.WriteMessage(req, l.conn, l.ctx)
ws.WriteMessage(req, l.conn, l.ctx)
}
/* Internal */