// SSE is a method for actions.SSE func (action *LedgerIndexAction) SSE(stream sse.Stream) { action.Setup(action.LoadQuery) action.Do( action.LoadRecords, func() { stream.SetLimit(int(action.Query.Limit)) records := action.Records[stream.SentCount():] for _, record := range records { var res resource.Ledger res.Populate(action.Ctx, record) stream.Send(sse.Event{ID: res.PagingToken(), Data: res}) } }, ) }