diff --git a/v1/client/client.go b/v1/client/client.go index 8cecd38..d1f6949 100644 --- a/v1/client/client.go +++ b/v1/client/client.go @@ -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 {