feat: add data retrieval close function

This commit is contained in:
2025-10-13 08:30:42 +07:00
parent bc2017e67d
commit 9c6db30550

View File

@@ -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,