@@ -160,58 +160,6 @@ func ExampleConn_Ping() {
160160 c .Close (websocket .StatusNormalClosure , "" )
161161}
162162
163- // This example demonstrates how to create a WebSocket server
164- // that gracefully exits when sent a signal.
165- //
166- // It starts a WebSocket server that keeps every connection open
167- // for 10 seconds.
168- // If you CTRL+C while a connection is open, it will wait at most 30s
169- // for all connections to terminate before shutting down.
170- // func ExampleGrace() {
171- // fn := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
172- // c, err := websocket.Accept(w, r, nil)
173- // if err != nil {
174- // log.Println(err)
175- // return
176- // }
177- // defer c.Close(websocket.StatusInternalError, "the sky is falling")
178- //
179- // ctx := c.CloseRead(r.Context())
180- // select {
181- // case <-ctx.Done():
182- // case <-time.After(time.Second * 10):
183- // }
184- //
185- // c.Close(websocket.StatusNormalClosure, "")
186- // })
187- //
188- // var g websocket.Grace
189- // s := &http.Server{
190- // Handler: g.Handler(fn),
191- // ReadTimeout: time.Second * 15,
192- // WriteTimeout: time.Second * 15,
193- // }
194- //
195- // errc := make(chan error, 1)
196- // go func() {
197- // errc <- s.ListenAndServe()
198- // }()
199- //
200- // sigs := make(chan os.Signal, 1)
201- // signal.Notify(sigs, os.Interrupt)
202- // select {
203- // case err := <-errc:
204- // log.Printf("failed to listen and serve: %v", err)
205- // case sig := <-sigs:
206- // log.Printf("terminating: %v", sig)
207- // }
208- //
209- // ctx, cancel := context.WithTimeout(context.Background(), time.Second*30)
210- // defer cancel()
211- // s.Shutdown(ctx)
212- // g.Shutdown(ctx)
213- // }
214-
215163// This example demonstrates full stack chat with an automated test.
216164func Example_fullStackChat () {
217165 // https://github.com/nhooyr/websocket/tree/master/examples/chat
0 commit comments