(inChannels base.Set, options db.ChangesOptions)
| 483 | } |
| 484 | |
| 485 | func (h *handler) sendContinuousChangesByHTTP(inChannels base.Set, options db.ChangesOptions) (error, bool) { |
| 486 | // Setting a non-default content type will keep the client HTTP framework from trying to sniff |
| 487 | // a real content-type from the response text, which can delay or prevent the client app from |
| 488 | // receiving the response. |
| 489 | h.setHeader("Content-Type", "application/octet-stream") |
| 490 | h.setHeader("Cache-Control", "private, max-age=0, no-cache, no-store") |
| 491 | h.logStatus(http.StatusOK, "sending continuous feed") |
| 492 | return h.generateContinuousChanges(inChannels, options, func(changes []*db.ChangeEntry) error { |
| 493 | var err error |
| 494 | if changes != nil { |
| 495 | for _, change := range changes { |
| 496 | data, _ := base.JSONMarshal(change) |
| 497 | if _, err = h.response.Write(data); err != nil { |
| 498 | break |
| 499 | } |
| 500 | if _, err = h.response.Write([]byte("\n")); err != nil { |
| 501 | break |
| 502 | } |
| 503 | |
| 504 | change.AuditReadEvent(h.ctx()) |
| 505 | } |
| 506 | } else { |
| 507 | _, err = h.response.Write([]byte("\n")) |
| 508 | } |
| 509 | h.flush() |
| 510 | return err |
| 511 | }) |
| 512 | } |
| 513 | |
| 514 | func (h *handler) sendContinuousChangesByWebSocket(inChannels base.Set, options db.ChangesOptions) (error, bool) { |
| 515 |
no test coverage detected