(ctx context.Context, payload []byte)
| 178 | } |
| 179 | |
| 180 | func (s *EventStream) SendRaw(ctx context.Context, payload []byte) error { |
| 181 | select { |
| 182 | case <-ctx.Done(): |
| 183 | return ctx.Err() |
| 184 | case <-s.ctx.Done(): |
| 185 | return s.ctx.Err() |
| 186 | case <-s.doneCh: |
| 187 | return ErrEventStreamClosed |
| 188 | case s.eventsCh <- payload: |
| 189 | return nil |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | // Shutdown gracefully shuts down the stream, sending any supplementary events downstream if required. |
| 194 | // ONLY call this once all events have been submitted. |