Stop stops the HTTP server
(ctx context.Context)
| 114 | |
| 115 | // Stop stops the HTTP server |
| 116 | func (b *TauriBridge) Stop(ctx context.Context) error { |
| 117 | if b.cancel != nil { |
| 118 | b.cancel() |
| 119 | } |
| 120 | |
| 121 | // Close all SSE clients |
| 122 | b.sseMu.Lock() |
| 123 | for _, ch := range b.sseClients { |
| 124 | close(ch) |
| 125 | } |
| 126 | b.sseClients = make(map[string]chan *FrontendEvent) |
| 127 | b.sseMu.Unlock() |
| 128 | |
| 129 | if b.server != nil { |
| 130 | return b.server.Shutdown(ctx) |
| 131 | } |
| 132 | return nil |
| 133 | } |
| 134 | |
| 135 | // RegisterAgent registers an agent with the bridge |
| 136 | func (b *TauriBridge) RegisterAgent(ag *agent.Agent) error { |