Stop stops the server and returns a channel indicating server is stopped.
()
| 61 | |
| 62 | // Stop stops the server and returns a channel indicating server is stopped. |
| 63 | func (ws *WebsocketServer) Stop() { |
| 64 | log.Warn("jsonrpc: shutdown server") |
| 65 | ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) |
| 66 | if err := ws.Server.Shutdown(ctx); err != nil { |
| 67 | log.WithError(err).Error("jsonrpc: shutdown server") |
| 68 | } |
| 69 | cancel() |
| 70 | log.Warn("jsonrpc: server stopped") |
| 71 | } |