mirror of
https://github.com/supanadit/geo-smart-system.git
synced 2025-01-31 12:58:58 +00:00
Fix SSE for Location Stream
This commit is contained in:
parent
9d2ae98856
commit
dc4627f503
@ -61,11 +61,12 @@ func Router(r *gin.Engine, client *redis.Client) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
r.GET("/point/get/stream", func(c *gin.Context) {
|
r.GET("/point/get/stream", func(c *gin.Context) {
|
||||||
w := c.Writer
|
writer := c.Writer
|
||||||
t := c.DefaultQuery("type", "user")
|
writer.Header().Set("Content-Type", "text/event-stream")
|
||||||
data, _ := tile38.FromScan(client, t)
|
writer.Header().Set("Cache-Control", "no-cache")
|
||||||
|
writer.Header().Set("Connection", "keep-alive")
|
||||||
_ = sse.Encode(w, sse.Event{
|
data, _ := tile38.FromScan(client, "user")
|
||||||
|
_ = sse.Encode(writer, sse.Event{
|
||||||
Event: "message",
|
Event: "message",
|
||||||
Data: data,
|
Data: data,
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user