2
0

Adds travis and godocs banners

This commit is contained in:
Manu Mtz-Almeida
2015-05-13 23:39:13 +02:00
parent 0656c24e21
commit 29bc476855
3 changed files with 5 additions and 4 deletions
+3
View File
@@ -1,5 +1,8 @@
#Server-Sent Events
[![GoDoc](https://godoc.org/github.com/manucorporat/sse?status.svg)](https://godoc.org/github.com/manucorporat/sse)
[![Build Status](https://travis-ci.org/manucorporat/sse.svg)](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.
[Read this great SSE introduction by the HTML5Rocks guys](http://www.html5rocks.com/en/tutorials/eventsource/basics/)
+2 -2
View File
@@ -8,12 +8,12 @@ import (
"strings"
)
const ContentType = "text/event-stream"
// Server-Sent Events
// W3C Working Draft 29 October 2009
// http://www.w3.org/TR/2009/WD-eventsource-20091029/
const ContentType = "text/event-stream"
type Event struct {
Event string
Id string
-2
View File
@@ -2,7 +2,6 @@ package sse
import (
"bytes"
"fmt"
"testing"
"github.com/stretchr/testify/assert"
@@ -143,6 +142,5 @@ func TestEncodeStream(t *testing.T) {
Event: "chat",
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")
}