forked from YaoApp/gou
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsocket.type.go
30 lines (27 loc) · 1.26 KB
/
socket.type.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package gou
import "github.com/yaoapp/gou/socket"
// Socket struct
type Socket struct {
Name string `json:"name"`
Version string `json:"version"`
Mode string `json:"mode,omitempty"` // Server | client
Description string `json:"description,omitempty"`
Protocol string `json:"protocol,omitempty"`
Host string `json:"host,omitempty"`
Port string `json:"port,omitempty"`
Event SocketEvent `json:"event,omitempty"`
Timeout int `json:"timeout,omitempty"` // timeout (seconds)
BufferSize int `json:"buffer,omitempty"` // bufferSize
KeepAlive int `json:"keep,omitempty"` // -1 not keep alive, 0 keep alive always, keep alive n seconds.
Process string `json:"process,omitempty"`
AttemptAfter int `json:"attempt_after,omitempty"` // Attempt attempt_after
Attempts int `json:"attempts,omitempty"` // max times try to reconnect server when connection break (client mode only)
client *socket.Client
}
// SocketEvent struct
type SocketEvent struct {
Data string `json:"data,omitempty"`
Error string `json:"error,omitempty"`
Closed string `json:"closed,omitempty"`
Connected string `json:"connected,omitempty"`
}