diff --git a/connection-handler.go b/connection-handler.go index 9f0dd89..0bb116e 100644 --- a/connection-handler.go +++ b/connection-handler.go @@ -20,9 +20,11 @@ type ConnectionHandlers struct { // The maximum number of concurrent connections the server may serve. // // DefaultConcurrency is used if not set. - Concurrency int - KeepAlive time.Duration - HandshakeTimeout time.Duration + Network string `json:"network"` + Address string `json:"address"` + Concurrency int `json:"concurrency"` + KeepAlive time.Duration `json:"keepAlive"` + HandshakeTimeout time.Duration `json:"handshakeTimeout"` TLSConfig *tls.Config } diff --git a/readwrite-handler.go b/readwrite-handler.go index 04261a1..0f64f33 100644 --- a/readwrite-handler.go +++ b/readwrite-handler.go @@ -13,7 +13,7 @@ type ReadWriteHandler interface { } type ReadWriteHandlers struct { - MaxMessageSize int64 + MaxMessageSize int64 `json:"maxMessageSize"` // Per-connection buffer size for requests' reading. // This also limits the maximum header size. // @@ -21,23 +21,23 @@ type ReadWriteHandlers struct { // and/or multi-KB headers (for example, BIG cookies). // // Default buffer size is used if not set. - ReadBufferSize int + ReadBufferSize int `json:"readBufferSize"` // Per-connection buffer size for responses' writing. // // Default buffer size is used if not set. - WriteBufferSize int + WriteBufferSize int `json:"writeBufferSize"` // 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 + ReadTimeout time.Duration `json:"readTimeout"` // Maximum duration for writing the full response (including body). // // By default response write timeout is unlimited. - WriteTimeout time.Duration + WriteTimeout time.Duration `json:"writeTimeout"` } func (rwh *ReadWriteHandlers) GetMaxMessageSize() int64 { diff --git a/server-handler.go b/server-handler.go index 5b9a07d..6f7ad94 100644 --- a/server-handler.go +++ b/server-handler.go @@ -20,7 +20,7 @@ type ServerHandlers struct { // Server name for sending in response headers. // // Default server name is used if left blank. - Name string + Name string `json:"name"` } func (sh *ServerHandlers) ServerCtx() ServerCtx { diff --git a/socket/client-conn-handler.go b/socket/client-conn-handler.go index 0325bbd..765ff0c 100644 --- a/socket/client-conn-handler.go +++ b/socket/client-conn-handler.go @@ -16,8 +16,8 @@ type ClientConnHandler interface { type ClientConnHandlers struct { server.ConnectionHandlers - ReconnectInterval time.Duration - ReconnectTryTime int + ReconnectInterval time.Duration `json:"reconnectInterval"` + ReconnectTryTime int `json:"reconnectTryTime"` } func (cch *ClientConnHandlers) GetReconnectInterval() time.Duration { diff --git a/socket/net/client.go b/socket/net/client.go index bee44a1..7d012e7 100644 --- a/socket/net/client.go +++ b/socket/net/client.go @@ -15,10 +15,10 @@ type Client struct { socket.ClientConnHandlers socket.ReadWriteHandlers - Name string + Name string `json:"name"` - Network string - Address string + Network string `json:"network"` + Address string `json:"address"` LocalAddress net.Addr stopChan chan struct{} diff --git a/socket/readwrite-handler.go b/socket/readwrite-handler.go index 1f50548..de8abc2 100644 --- a/socket/readwrite-handler.go +++ b/socket/readwrite-handler.go @@ -18,11 +18,11 @@ type ReadWriteHandler interface { type ReadWriteHandlers struct { server.ReadWriteHandlers - PongTimeout time.Duration - PingTimeout time.Duration - PingPeriod time.Duration + PongTimeout time.Duration `json:"pongTimeout"` + PingTimeout time.Duration `json:"pingTimeout"` + PingPeriod time.Duration `json:"pingPeriod"` - EnableCompression bool + EnableCompression bool `json:"enableCompression"` } func (rwh *ReadWriteHandlers) GetPongTimeout() time.Duration {