rename module
This commit is contained in:
@@ -1,15 +0,0 @@
|
|||||||
# To get started with Dependabot version updates, you'll need to specify which
|
|
||||||
# package ecosystems to update and where the package manifests are located.
|
|
||||||
# Please see the documentation for all configuration options:
|
|
||||||
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
|
||||||
|
|
||||||
version: 2
|
|
||||||
updates:
|
|
||||||
- package-ecosystem: github-actions
|
|
||||||
directory: /
|
|
||||||
schedule:
|
|
||||||
interval: weekly
|
|
||||||
- package-ecosystem: gomod
|
|
||||||
directory: /
|
|
||||||
schedule:
|
|
||||||
interval: weekly
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
name: Go
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ master ]
|
|
||||||
pull_request:
|
|
||||||
branches: [ master ]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
lint:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Setup go
|
|
||||||
uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: 1.16
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Setup golangci-lint
|
|
||||||
uses: golangci/golangci-lint-action@v3.2.0
|
|
||||||
with:
|
|
||||||
version: v1.41.1
|
|
||||||
args: --verbose
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
env:
|
|
||||||
GO111MODULE: on
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
go-version: [1.13, 1.14, 1.15, 1.16, 1.17]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- uses: actions/cache@v3.2.5
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
~/.cache/go-build
|
|
||||||
~/go/pkg/mod
|
|
||||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-go-
|
|
||||||
|
|
||||||
- name: Set up Go
|
|
||||||
uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: ${{ matrix.go-version }}
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: go build -v ./...
|
|
||||||
|
|
||||||
- name: Test
|
|
||||||
run: go test -race -v -count=1 -coverprofile=coverage.out ./...
|
|
||||||
- uses: codecov/codecov-action@v3
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
|
||||||
flags: go-${{ matrix.go-version }}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
linters:
|
|
||||||
disable:
|
|
||||||
- errcheck
|
|
||||||
@@ -1,19 +1,16 @@
|
|||||||
# Server-Sent Events
|
# Server-Sent Events
|
||||||
|
|
||||||
[](https://pkg.go.dev/github.com/gin-contrib/sse)
|
|
||||||
[](https://github.com/gin-contrib/sse/actions/workflows/go.yml)
|
|
||||||
[](https://codecov.io/gh/gin-contrib/sse)
|
|
||||||
[](https://goreportcard.com/report/github.com/gin-contrib/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](http://www.w3.org/TR/2009/WD-eventsource-20091029/).
|
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](http://www.w3.org/TR/2009/WD-eventsource-20091029/).
|
||||||
|
|
||||||
- [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/)
|
||||||
- [Browser support](http://caniuse.com/#feat=eventsource)
|
- [Browser support](http://caniuse.com/#feat=eventsource)
|
||||||
|
|
||||||
|
Copied from [gin-contrib/sse](https://github.com/gin-contrib/sse)
|
||||||
|
|
||||||
## Sample code
|
## Sample code
|
||||||
|
|
||||||
```go
|
```go
|
||||||
import "github.com/gin-contrib/sse"
|
import "git.company.lan/gopkg/gin-sse"
|
||||||
|
|
||||||
func httpHandler(w http.ResponseWriter, req *http.Request) {
|
func httpHandler(w http.ResponseWriter, req *http.Request) {
|
||||||
// data can be a primitive like a string, an integer or a float
|
// data can be a primitive like a string, an integer or a float
|
||||||
@@ -34,6 +31,7 @@ func httpHandler(w http.ResponseWriter, req *http.Request) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
```
|
```
|
||||||
event: message
|
event: message
|
||||||
data: some data\\nmore data
|
data: some data\\nmore data
|
||||||
@@ -41,7 +39,7 @@ data: some data\\nmore data
|
|||||||
id: 124
|
id: 124
|
||||||
event: message
|
event: message
|
||||||
data: {"content":"hi!","date":1431540810,"user":"manu"}
|
data: {"content":"hi!","date":1431540810,"user":"manu"}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Content-Type
|
## Content-Type
|
||||||
@@ -49,6 +47,7 @@ data: {"content":"hi!","date":1431540810,"user":"manu"}
|
|||||||
```go
|
```go
|
||||||
fmt.Println(sse.ContentType)
|
fmt.Println(sse.ContentType)
|
||||||
```
|
```
|
||||||
|
|
||||||
```
|
```
|
||||||
text/event-stream
|
text/event-stream
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user