Adds travis and godocs banners
This commit is contained in:
@@ -1,5 +1,8 @@
|
|||||||
#Server-Sent Events
|
#Server-Sent Events
|
||||||
|
|
||||||
|
[](https://godoc.org/github.com/manucorporat/sse)
|
||||||
|
[](https://travis-ci.org/manucorporat/sse)
|
||||||
|
|
||||||
Server-sent events (SSE) is a technology where a browser receives automatic updates from a server via HTTP connection. The Server-Sent Events EventSource API is standardized as part of HTML5[1] by the W3C.
|
Server-sent events (SSE) is a technology where a browser receives automatic updates from a server via HTTP connection. The Server-Sent Events EventSource API is standardized as part of HTML5[1] by the W3C.
|
||||||
|
|
||||||
[Read this great SSE introduction by the HTML5Rocks guys](http://www.html5rocks.com/en/tutorials/eventsource/basics/)
|
[Read this great SSE introduction by the HTML5Rocks guys](http://www.html5rocks.com/en/tutorials/eventsource/basics/)
|
||||||
|
|||||||
+2
-2
@@ -8,12 +8,12 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
const ContentType = "text/event-stream"
|
|
||||||
|
|
||||||
// Server-Sent Events
|
// Server-Sent Events
|
||||||
// W3C Working Draft 29 October 2009
|
// W3C Working Draft 29 October 2009
|
||||||
// http://www.w3.org/TR/2009/WD-eventsource-20091029/
|
// http://www.w3.org/TR/2009/WD-eventsource-20091029/
|
||||||
|
|
||||||
|
const ContentType = "text/event-stream"
|
||||||
|
|
||||||
type Event struct {
|
type Event struct {
|
||||||
Event string
|
Event string
|
||||||
Id string
|
Id string
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package sse
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
@@ -143,6 +142,5 @@ func TestEncodeStream(t *testing.T) {
|
|||||||
Event: "chat",
|
Event: "chat",
|
||||||
Data: "hi! dude",
|
Data: "hi! dude",
|
||||||
})
|
})
|
||||||
fmt.Println(w.String())
|
|
||||||
assert.Equal(t, w.String(), "event: float\ndata: 1.5\n\nid: 123\ndata: {\"bar\":\"foo\",\"foo\":\"bar\"}\n\nid: 124\nevent: chat\ndata: hi! dude\n\n")
|
assert.Equal(t, w.String(), "event: float\ndata: 1.5\n\nid: 123\ndata: {\"bar\":\"foo\",\"foo\":\"bar\"}\n\nid: 124\nevent: chat\ndata: hi! dude\n\n")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user