2
0

Adds some documentation about the standard

This commit is contained in:
Manu Mtz-Almeida
2015-05-13 23:19:17 +02:00
parent 5233ec6bf2
commit 1d0f1f9c05
+6
View File
@@ -8,6 +8,10 @@ import (
"strings"
)
// Server-Sent Events
// W3C Working Draft 29 October 2009
// http://www.w3.org/TR/2009/WD-eventsource-20091029/
type Event struct {
Event string
Id string
@@ -70,6 +74,8 @@ func typeOfData(data interface{}) reflect.Kind {
}
func escape(str string) string {
// any-char = %x0000-0009 / %x000B-000C / %x000E-10FFFF
// ; a Unicode character other than U+000A LINE FEED (LF) or U+000D CARRIAGE RETURN (CR)
str = strings.Replace(str, "\n", "\\n", -1)
str = strings.Replace(str, "\r", "\\r", -1)
return str