From da19884f6c97ae6005671efe3169c96ef81baaff Mon Sep 17 00:00:00 2001
From: jano3 <jano@bob.co.za>
Date: Fri, 24 May 2024 09:01:56 +0200
Subject: [PATCH] #40 Fix sending data via websocket

---
 websocket_utils/websocket_utils.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/websocket_utils/websocket_utils.go b/websocket_utils/websocket_utils.go
index c6a6224..3a77890 100644
--- a/websocket_utils/websocket_utils.go
+++ b/websocket_utils/websocket_utils.go
@@ -53,7 +53,7 @@ func NewSession(session *session.Session) *APIGateWaySessionWithHelpers {
 	}
 }
 
-func (s APIGateWaySessionWithHelpers) PostToConnectionIDs(req *events.APIGatewayWebsocketProxyRequest, connectionIDs []string) error {
+func (s APIGateWaySessionWithHelpers) PostToConnectionIDs(data []byte, req *events.APIGatewayWebsocketProxyRequest, connectionIDs []string) error {
 	if req == nil {
 		return errors.Error("websocket request is nil")
 	}
@@ -62,7 +62,7 @@ func (s APIGateWaySessionWithHelpers) PostToConnectionIDs(req *events.APIGateway
 		s.APIGatewaySession.Endpoint = fmt.Sprintf("https://%s/%s", req.RequestContext.DomainName, req.RequestContext.Stage)
 		_, err := s.APIGatewaySession.PostToConnection(&apigatewaymanagementapi.PostToConnectionInput{
 			ConnectionId: &connectionID,
-			Data:         []byte("This is a message sent to the requesting connection ID via websocket."),
+			Data:         data,
 		})
 		if err != nil {
 			return err
-- 
GitLab