Replace math rand with crypto rand

This commit is contained in:
Stefan Kostic
2022-04-13 20:21:35 +02:00
parent bbe47cbd4c
commit e2947cf9a1
5 changed files with 51 additions and 25 deletions

View File

@@ -33,7 +33,10 @@ func (controller *InvoiceStreamController) StreamInvoices(c echo.Context) error
return err
}
invoiceChan := make(chan models.Invoice)
subId := controller.svc.InvoicePubSub.Subscribe(userId, invoiceChan)
subId, err := controller.svc.InvoicePubSub.Subscribe(userId, invoiceChan)
if err != nil {
return err
}
upgrader := websocket.Upgrader{}
upgrader.CheckOrigin = func(r *http.Request) bool { return true }
ticker := time.NewTicker(30 * time.Second)