fix ws closing

This commit is contained in:
yyasha 2024-06-05 10:38:16 +03:00
parent 784d4a6006
commit 6f0dec9e93
1 changed files with 4 additions and 0 deletions

View File

@ -121,6 +121,10 @@ func (b *WebSocket) Connect(args []string) error {
eg.Go(b.Ping)
eg.Go(b.handleIncomingMessages)
if err := b.sendSubscription(args); err != nil {
return fmt.Errorf("failed to send subscription: %w", err)
}
if err := eg.Wait(); err != nil {
b.Disconnect()
return fmt.Errorf("failed to handle message: %w", err)