@@ -14,18 +14,17 @@ import (
1414 "github.com/Flagsmith/flagsmith-go-client/v4/flagengine/environments"
1515)
1616
17- // realtime handles the SSE connection and reconnection logic
17+ // realtime handles the SSE connection and reconnection logic.
1818type realtime struct {
19- client * Client
20- ctx context.Context
21- log * slog.Logger
22- streamURL string
23- envUpdatedAt time.Time
24- backoff * backoff
25- reconnectChan chan struct {}
19+ client * Client
20+ ctx context.Context
21+ log * slog.Logger
22+ streamURL string
23+ envUpdatedAt time.Time
24+ backoff * backoff
2625}
2726
28- // newRealtime creates a new realtime instance
27+ // newRealtime creates a new realtime instance.
2928func newRealtime (client * Client , ctx context.Context , streamURL string , envUpdatedAt time.Time ) * realtime {
3029 return & realtime {
3130 client : client ,
@@ -40,7 +39,7 @@ func newRealtime(client *Client, ctx context.Context, streamURL string, envUpdat
4039 }
4140}
4241
43- // start begins the realtime connection process
42+ // start begins the realtime connection process.
4443func (r * realtime ) start () {
4544 r .log .Debug ("connecting to realtime" )
4645 defer func () {
@@ -59,7 +58,7 @@ func (r *realtime) start() {
5958 }
6059}
6160
62- // connect establishes and maintains the SSE connection
61+ // connect establishes and maintains the SSE connection.
6362func (r * realtime ) connect () error {
6463 resp , err := http .Get (r .streamURL )
6564 if err != nil {
@@ -96,7 +95,7 @@ func (r *realtime) connect() error {
9695 return nil
9796}
9897
99- // handleEvent processes a single SSE event
98+ // handleEvent processes a single SSE event.
10099func (r * realtime ) handleEvent (line string ) error {
101100 parsedTime , err := parseUpdatedAtFromSSE (line )
102101 if err != nil {
0 commit comments