• With issues:
  • Use the search tool before opening a new issue.
  • Please provide source code and commit sha if you found a bug.
  • Review existing issues and provide feedback or react to them.

Description

context.SSEvent only has arguments for the name of the event and the content to place in the body. If the browser reconnects or has intermittent connection, id is used by the browser to recover and continue streaming data.

Can we add an id to this block of code to resolve this issue?

Old code:

// SSEvent writes a Server-Sent Event into the body stream.
func (c *Context) SSEvent(name string, message interface{}) {
    c.Render(-1, sse.Event{
        Event: name,
        Data:  message,
    })
}

New Code:

// SSEvent writes a Server-Sent Event into the body stream.
func (c *Context) SSEvent(name string, message interface{}, id int) {
    c.Render(-1, sse.Event{
        Event: name,
        id: id,
        Data:  message,
    })
}

Comment From: idc77

The whole SSE thing needs to be redesigned. It might be better to just manually handle SSE