move emitStart method call into the stream Connect method

This commit is contained in:
c9s 2021-03-16 01:32:27 +08:00
parent 7951c38edc
commit 2f7c7d344b
3 changed files with 9 additions and 3 deletions

View File

@ -490,8 +490,6 @@ func (environ *Environment) Connect(ctx context.Context) error {
if err := session.Stream.Connect(ctx); err != nil {
return err
}
session.Stream.EmitStart()
}
return nil

View File

@ -310,6 +310,8 @@ func (s *Stream) Connect(ctx context.Context) error {
}
go s.read(ctx)
s.EmitStart()
return nil
}

View File

@ -171,7 +171,13 @@ func (s *Stream) Subscribe(channel types.Channel, symbol string, options types.S
}
func (s *Stream) Connect(ctx context.Context) error {
return s.websocketService.Connect(ctx)
err := s.websocketService.Connect(ctx)
if err != nil {
return err
}
s.EmitStart()
return nil
}
func (s *Stream) Close() error {