Compare commits

..

1 Commits

Author SHA1 Message Date
9d74e72ede feat: add writeJSON function 2025-09-29 14:40:07 +07:00

View File

@@ -337,6 +337,12 @@ func (wsClient *SafeWebsocketClient) DataChannel() <-chan []byte {
return wsClient.dataChannel
}
func (wsClient *SafeWebsocketClient) WriteJSON(message any) error {
return wsClient.mu.WriteHandler(func() error {
return wsClient.conn.WriteJSON(message)
})
}
func (wsClient *SafeWebsocketClient) Close() error {
wsClient.mu.WriteHandler(func() error {
if wsClient.cancelFuncs != nil {