diff --git a/client/connector.go b/client/connector.go index 80df1ed..dd3b252 100644 --- a/client/connector.go +++ b/client/connector.go @@ -13,7 +13,7 @@ type Connector interface { } type Connectors struct { - Name string `json:"name"` + Name string `json:"name,omitempty"` validated atomic.Value } diff --git a/connection-handler.go b/connection-handler.go index 7825267..fd99c5a 100644 --- a/connection-handler.go +++ b/connection-handler.go @@ -20,11 +20,11 @@ type ConnectionHandlers struct { // The maximum number of concurrent connections the server may serve. // // DefaultConcurrency is used if not set. - Network string `json:"network"` - Address string `json:"address"` - Concurrency int `json:"concurrency"` - KeepAlive time.Duration `json:"keepAlive"` - HandshakeTimeout time.Duration `json:"handshakeTimeout"` + Network string `json:"network,omitempty"` + Address string `json:"address,omitempty"` + Concurrency int `json:"concurrency,omitempty"` + KeepAlive time.Duration `json:"keepAlive,omitempty"` + HandshakeTimeout time.Duration `json:"handshakeTimeout,omitempty"` TLSConfig *tls.Config `json:"-"` validated atomic.Value } diff --git a/readwrite-handler.go b/readwrite-handler.go index 220f152..4b3024d 100644 --- a/readwrite-handler.go +++ b/readwrite-handler.go @@ -14,7 +14,7 @@ type ReadWriteHandler interface { } type ReadWriteHandlers struct { - MaxMessageSize int64 `json:"maxMessageSize"` + MaxMessageSize int64 `json:"maxMessageSize,omitempty"` // Per-connection buffer size for requests' reading. // This also limits the maximum header size. // @@ -22,23 +22,23 @@ type ReadWriteHandlers struct { // and/or multi-KB headers (for example, BIG cookies). // // Default buffer size is used if not set. - ReadBufferSize int `json:"readBufferSize"` + ReadBufferSize int `json:"readBufferSize,omitempty"` // Per-connection buffer size for responses' writing. // // Default buffer size is used if not set. - WriteBufferSize int `json:"writeBufferSize"` + WriteBufferSize int `json:"writeBufferSize,omitempty"` // Maximum duration for reading the full request (including body). // // This also limits the maximum duration for idle keep-alive // connections. // // By default request read timeout is unlimited. - ReadTimeout time.Duration `json:"readTimeout"` + ReadTimeout time.Duration `json:"readTimeout,omitempty"` // Maximum duration for writing the full response (including body). // // By default response write timeout is unlimited. - WriteTimeout time.Duration `json:"writeTimeout"` + WriteTimeout time.Duration `json:"writeTimeout,omitempty"` validated atomic.Value } diff --git a/server-handler.go b/server-handler.go index e12aa87..5d016b4 100644 --- a/server-handler.go +++ b/server-handler.go @@ -22,7 +22,7 @@ type ServerHandlers struct { // Server name for sending in response headers. // // Default server name is used if left blank. - Name string `json:"name"` + Name string `json:"name,omitempty"` validated atomic.Value } diff --git a/socket/client-conn-handler.go b/socket/client-conn-handler.go index be8c4e3..2d9a664 100644 --- a/socket/client-conn-handler.go +++ b/socket/client-conn-handler.go @@ -17,8 +17,8 @@ type ClientConnHandler interface { type ClientConnHandlers struct { server.ConnectionHandlers - ReconnectInterval time.Duration `json:"reconnectInterval"` - ReconnectTryTime int `json:"reconnectTryTime"` + ReconnectInterval time.Duration `json:"reconnectInterval,omitempty"` + ReconnectTryTime int `json:"reconnectTryTime,omitempty"` validated atomic.Value } diff --git a/socket/net/client/connector.go b/socket/net/client/connector.go index 4f62af1..b12dbd9 100644 --- a/socket/net/client/connector.go +++ b/socket/net/client/connector.go @@ -18,8 +18,8 @@ type Connectors struct { socket.ClientConnHandlers socket.ReadWriteHandlers - Network string `json:"network"` - Address string `json:"address"` + Network string `json:"network,omitempty"` + Address string `json:"address,omitempty"` LocalAddress net.Addr `json:"-"` stopChan chan struct{} diff --git a/socket/readwrite-handler.go b/socket/readwrite-handler.go index 243ee02..aa20b22 100644 --- a/socket/readwrite-handler.go +++ b/socket/readwrite-handler.go @@ -19,11 +19,11 @@ type ReadWriteHandler interface { type ReadWriteHandlers struct { server.ReadWriteHandlers - PongTimeout time.Duration `json:"pongTimeout"` - PingTimeout time.Duration `json:"pingTimeout"` - PingPeriod time.Duration `json:"pingPeriod"` + PongTimeout time.Duration `json:"pongTimeout,omitempty"` + PingTimeout time.Duration `json:"pingTimeout,omitempty"` + PingPeriod time.Duration `json:"pingPeriod,omitempty"` - EnableCompression bool `json:"enableCompression"` + EnableCompression bool `json:"enableCompression,omitempty"` validated atomic.Value } diff --git a/socket/web/client/connector.go b/socket/web/client/connector.go index 998232a..507c016 100644 --- a/socket/web/client/connector.go +++ b/socket/web/client/connector.go @@ -30,11 +30,11 @@ type Connectors struct { socket.ClientConnHandlers socket.ReadWriteHandlers - URL string `json:"url"` + URL string `json:"url,omitempty"` RequestHeader func() http.Header `json:"-"` - Subprotocols []string `json:"subprotocols"` + Subprotocols []string `json:"subprotocols,omitempty"` // Jar specifies the cookie jar. // If Jar is nil, cookies are not sent in requests and ignored // in responses.