-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Description
The model defined in
| case class ServerSentEvent( | |
| data: Option[String] = None, | |
| eventType: Option[String] = None, | |
| id: Option[String] = None, | |
| retry: Option[Int] = None | |
| ) { | |
| override def toString: String = { | |
| val _data = data.map(_.split("\n")).map(_.map(line => Some(s"data: $line"))).getOrElse(Array.empty[Option[String]]) | |
| val _event = eventType.map(event => s"event: $event") | |
| val _id = id.map(id => s"id: $id") | |
| val _retry = retry.map(retryCount => s"retry: $retryCount") | |
| (_data :+ _event :+ _id :+ _retry).flatten.mkString("\n") | |
| } | |
| } |
Specifically, this part:
If the line starts with a U+003A COLON character (:)
Ignore the line.
Therefore there is currently no way to send or receive "comment" messages, which are useful to perform keep-alives.
One could argue that you can just send event: keep-alive here, to which I agree, but just noticed this discrepancy and wondered whether we should add a way to send out these comment messages.
Metadata
Metadata
Assignees
Labels
No labels