瀏覽代碼

Adds Content-Type

Manu Mtz-Almeida 10 年之前
父節點
當前提交
489af8e7c7
共有 2 個文件被更改,包括 12 次插入0 次删除
  1. 10 0
      README.md
  2. 2 0
      sse-encoder.go

+ 10 - 0
README.md

@@ -6,6 +6,8 @@ Server-sent events (SSE) is a technology where a browser receives automatic upda
 
 
 [Real world demostration using Gin](http://sse.getgin.io/)
 [Real world demostration using Gin](http://sse.getgin.io/)
 
 
+##Sample code
+
 ```go
 ```go
 import "github.com/manucorporat/sse"
 import "github.com/manucorporat/sse"
 
 
@@ -38,3 +40,11 @@ data: {"content":"hi!","date":1431540810,"user":"manu"}
  
  
 ```
 ```
 
 
+##Content-Type
+
+```go
+fmt.Println(sse.ContentType)
+```
+```
+text/event-stream
+```

+ 2 - 0
sse-encoder.go

@@ -8,6 +8,8 @@ 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/