Go 1.8

net/http

Roberto Ortega

Instructor at Galvanize

Go since Sept 2015

New HTTP features

  • http.Server.Close

  • http.Server.Shutdown

  • http.Pusher

Close

http.ErrServerClosed

err := srv.ListenAndServe()
if err != http.ErrServerClosed {
    log.Fatal("listen: %s\n", err)
}

DEMO

Shutdown

Will close all listeners, stop accepting new connections and waits until all requests are finished.

Stops accepting new connections

Stops fulfilling new requests

Waits for in-flight requests to complete

https://github.com/facebookgo/httpdown

https://github.com/tylerb/graceful

 

http.Pusher

http 1.1 since 1999

http2

https://http2.golang.org/gophertiles

Pusher

https://github.com/madari/pusher.go

https://github.com/pusher/pusher-http-go

Demo

Roberto Ortega

roberto.ortega@galvanize.com

github.com/berto

Golang 1.8

By Roberto Ortega

Golang 1.8

  • 456