Skip to content

Commit

Permalink
Fix SSE for Location Stream
Browse files Browse the repository at this point in the history
  • Loading branch information
supanadit committed Jan 4, 2020
1 parent 9d2ae98 commit dc4627f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions system/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,12 @@ func Router(r *gin.Engine, client *redis.Client) {
})

r.GET("/point/get/stream", func(c *gin.Context) {
w := c.Writer
t := c.DefaultQuery("type", "user")
data, _ := tile38.FromScan(client, t)

_ = sse.Encode(w, sse.Event{
writer := c.Writer
writer.Header().Set("Content-Type", "text/event-stream")
writer.Header().Set("Cache-Control", "no-cache")
writer.Header().Set("Connection", "keep-alive")
data, _ := tile38.FromScan(client, "user")
_ = sse.Encode(writer, sse.Event{
Event: "message",
Data: data,
})
Expand Down

0 comments on commit dc4627f

Please sign in to comment.