Skip to content

Latest commit

 

History

History
108 lines (73 loc) · 2.62 KB

File metadata and controls

108 lines (73 loc) · 2.62 KB

Boilerplate for WebSocket Microservice in Go

Build Status codecov Go Report Card GoDoc License

Features

  • WebSocket API
  • Middlewares (cors, gzip and static)
  • CI with Travis
  • Docker Build

Installation

Get the micro-websocket repository

go get github.com/goboilerplates/micro-websocket

cd echo $GOPATH/src/github.com/goboilerplates/micro-websocket

And install dependencies

go get -u github.com/golang/dep/cmd/dep

dep ensure

Running the tests

Run all tests

go test ./...

Or run all tests with coverage

bash script/coverage.sh

Build and Run

Run main.go

# serve at localhost:9000
go run main.go

Build and run native binary

bash script/Build.sh

./micro-websocket.out

Build native binary for multiple platforms (darwin, windows and linux)

bash script/BuildMulti.sh

Environment variables

    # enable production mode, default is false
    env GBP_PROMODE=true
    
     # enable compression, default is true
    env GONI_COMPRESS=false

    # set read buffer size, default equals to 1024
    env GONI_RBSIZE=2048

    # set write buffer size, default equals to 1024
    env GONI_WBSIZE=2048

Docker support

Build docker image

bash script/Dockerbuild.sh

Run docker container

docker run -d --name micro-websocket -p 9000:9000 goboilerplates/micro-websocket

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

License

This project is licensed under the MIT License - see the LICENSE file for details