feat: add data retrieval close function
This commit is contained in:
@@ -338,7 +338,7 @@ func (wsClient *SafeWebsocketClient) startPingTicker(ctx context.Context) {
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
log.Println("ping ticker stopped")
|
||||
log.Println("ping ticker canceled by context")
|
||||
return
|
||||
case <-ticker.C:
|
||||
wsClient.writeChan <- Message{
|
||||
@@ -425,6 +425,10 @@ func (wsClient *SafeWebsocketClient) DataChannel() <-chan []byte {
|
||||
return wsClient.dataChannel
|
||||
}
|
||||
|
||||
func (wsClient *SafeWebsocketClient) CloseDataChannel() {
|
||||
close(wsClient.dataChannel)
|
||||
}
|
||||
|
||||
func (wsClient *SafeWebsocketClient) Write(data []byte) error {
|
||||
wsClient.writeChan <- Message{
|
||||
MessageType: MessageTypeText,
|
||||
|
||||
Reference in New Issue
Block a user