mirror of
https://github.com/fiatjaf/khatru.git
synced 2026-06-04 01:31:12 +02:00
NewRelayWithContext() and Close().
This commit is contained in:
3
start.go
3
start.go
@@ -2,6 +2,7 @@ package khatru
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"strconv"
|
||||
@@ -48,6 +49,8 @@ func (rl *Relay) Start(host string, port int, started ...chan bool) error {
|
||||
|
||||
// Shutdown sends a websocket close control message to all connected clients.
|
||||
func (rl *Relay) Shutdown(ctx context.Context) {
|
||||
rl.cancel(fmt.Errorf("Shutdown called"))
|
||||
|
||||
rl.httpServer.Shutdown(ctx)
|
||||
|
||||
rl.clients.Range(func(conn *websocket.Conn, _ struct{}) bool {
|
||||
|
||||
Reference in New Issue
Block a user