@@ -196,7 +196,7 @@ func (m *Manager) StreamUserTransactions(w http.ResponseWriter, r *http.Request)
196196 defer cancel ()
197197
198198 /* sending initial list of transactions data */
199- if err := m .sendCurrentUserTransactions (conn , username , sessionID , 100 ); err != nil {
199+ if err := m .sendCurrentUserTransactions (conn , sessionID , 100 ); err != nil {
200200 m .errCh <- fmt .Errorf ("error sending initial transactions: %w" , err )
201201 return
202202 }
@@ -338,85 +338,3 @@ func (m *Manager) StreamUserArchivePendingTransactions(w http.ResponseWriter, r
338338 /* handle web socket instructions from client */
339339 m .handleWebSocketCommands (conn , username , sessionID , ctxVal , cancel )
340340}
341-
342- // /*
343- // get all sessions in the system
344- // requires admin authentication from middleware
345- // admin/
346- // */
347- // func (m *Manager) StreamAllSessions(w http.ResponseWriter, r *http.Request) {
348- //
349- // /* check if the user is admin */
350- //
351- // /* upgrade the connection if user is admin */
352- // conn, err := m.upgrader.Upgrade(w, r, nil)
353- // if err != nil {
354- // m.errCh <- fmt.Errorf("websocket upgrade error: %w", err)
355- // return
356- // }
357- // defer conn.Close()
358- //
359- // /*
360- // context with cancel for web socket handlers
361- // this is the official context for a websocket connection
362- // cancelling this means closing components of the websocket handler
363- // */
364- // ctx, cancel := context.WithCancel(context.Background())
365- // defer cancel()
366- //
367- // /* sending initial list of all sessions */
368- // if err := m.sendListofAllSessions(conn, 100); err != nil {
369- // m.errCh <- fmt.Errorf("error sending initial list of all sessions: %w", err)
370- // return
371- // }
372- //
373- // /* stream changes in transactions made in redis */
374- // go m.listenForAllSessionsChanges(ctx, conn)
375- //
376- // /* specify the handler context */
377- // ctxVal := context.WithValue(ctx, "type", CtxStreamAllSessions)
378- //
379- // /* handle web socket instructions from client */
380- // m.handleWebSocketCommands(conn, ctxVal, cancel)
381- // }
382- //
383- // /*
384- // get all transaction in the system
385- // requires admin authentication from middleware
386- // admin/
387- // */
388- // func (m *Manager) StreamAllTransactions(w http.ResponseWriter, r *http.Request) {
389- //
390- // /* check if the user is admin */
391- //
392- // /* upgrade the connection if user is admin */
393- // conn, err := m.upgrader.Upgrade(w, r, nil)
394- // if err != nil {
395- // m.errCh <- fmt.Errorf("websocket upgrade error: %w", err)
396- // return
397- // }
398- // defer conn.Close()
399- //
400- // /*
401- // context with cancel for web socket handlers
402- // this is the official context for a websocket connection
403- // cancelling this means closing components of the websocket handler
404- // */
405- // ctx, cancel := context.WithCancel(context.Background())
406- // defer cancel()
407- //
408- // /* sending initial list of all sessions */
409- // if err := m.sendListofAllTransactions(conn, 100); err != nil {
410- // m.errCh <- fmt.Errorf("error sending initial list of all transactions: %w", err)
411- // return
412- // }
413- //
414- // /* stream changes in transactions made in redis */
415- // go m.listenForAllTransactionsChanges(ctx, conn)
416- //
417- // /* specify the handler context */
418- // ctxVal := context.WithValue(ctx, "type", CtxStreamAllTransactions)
419- //
420- // /* handle web socket instructions from client */
421- // m.handleWebSocketCommands(conn, ctxVal, cancel)
422- // }
0 commit comments